home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1996-01-26 | 43.4 KB | [TEXT/CWIE] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [CWIE] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 05 43 47 49 2e 63 00 | 00 00 00 00 00 00 00 00 |..CGI.c.|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 00 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 aa 95 00 | 00 01 9a ad 2e 28 72 ad |........|.....(r.|
|00000060| 2e 28 72 00 00 04 00 00 | 00 00 00 00 00 00 00 00 |.(r.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 60 c6 00 00 |........|....`...|
|00000080| 2f 2a 2a 2a 2a 2a 0d 20 | 2a 0d 20 2a 09 47 72 61 |/*****. |*. *.Gra|
|00000090| 6e 74 27 73 20 43 47 49 | 20 46 72 61 6d 65 77 6f |nt's CGI| Framewo|
|000000a0| 72 6b 0d 20 2a 09 09 28 | 43 6f 6d 6d 6f 6e 20 47 |rk. *..(|Common G|
|000000b0| 72 61 6e 74 20 49 6e 74 | 65 72 66 61 63 65 20 3a |rant Int|erface :|
|000000c0| 2d 29 0d 20 2a 09 09 62 | 79 20 47 72 61 6e 74 20 |-). *..b|y Grant |
|000000d0| 4e 65 75 66 65 6c 64 0d | 20 2a 09 09 68 74 74 70 |Neufeld.| *..http|
|000000e0| 3a 2f 2f 61 72 70 70 31 | 2e 63 61 72 6c 65 74 6f |://arpp1|.carleto|
|000000f0| 6e 2e 63 61 2f 67 72 61 | 6e 74 2f 6d 61 63 2f 67 |n.ca/gra|nt/mac/g|
|00000100| 72 61 6e 74 73 63 67 69 | 2f 0d 20 2a 0d 20 2a 09 |rantscgi|/. *. *.|
|00000110| 43 47 49 2e 63 0d 20 2a | 0d 20 2a 09 53 74 61 6e |CGI.c. *|. *.Stan|
|00000120| 64 61 72 64 20 66 75 6e | 63 74 69 6f 6e 73 20 66 |dard fun|ctions f|
|00000130| 6f 72 20 63 67 69 20 61 | 70 70 6c 69 63 61 74 69 |or cgi a|pplicati|
|00000140| 6f 6e 73 2e 0d 20 2a 0d | 20 2a 09 59 6f 75 20 6d |ons.. *.| *.You m|
|00000150| 75 73 74 20 63 61 6c 6c | 20 49 6e 69 74 43 47 49 |ust call| InitCGI|
|00000160| 55 74 69 6c 20 69 6e 20 | 79 6f 75 72 20 61 70 70 |Util in |your app|
|00000170| 6c 69 63 61 74 69 6f 6e | 20 73 74 61 72 74 75 70 |lication| startup|
|00000180| 2e 0d 20 2a 09 59 6f 75 | 20 6d 75 73 74 20 69 6e |.. *.You| must in|
|00000190| 73 74 61 6c 6c 20 43 47 | 49 41 45 48 61 6e 64 6c |stall CG|IAEHandl|
|000001a0| 65 20 61 73 20 74 68 65 | 20 65 76 65 6e 74 20 68 |e as the| event h|
|000001b0| 61 6e 64 6c 65 72 20 66 | 6f 72 20 74 68 65 20 57 |andler f|or the W|
|000001c0| 57 57 bd 73 64 6f 63 20 | 61 70 70 6c 65 20 65 76 |WW.sdoc |apple ev|
|000001d0| 65 6e 74 0d 20 2a 09 59 | 6f 75 20 6d 75 73 74 20 |ent. *.Y|ou must |
|000001e0| 77 72 69 74 65 20 74 68 | 65 20 66 75 6e 63 74 69 |write th|e functi|
|000001f0| 6f 6e 3a 0d 20 2a 09 09 | 76 6f 69 64 20 4d 79 43 |on:. *..|void MyC|
|00000200| 47 49 50 72 6f 63 65 73 | 73 20 28 20 43 47 49 48 |GIProces|s ( CGIH|
|00000210| 64 6c 20 74 68 65 43 47 | 49 48 64 6c 20 29 0d 20 |dl theCG|IHdl ). |
|00000220| 2a 09 09 77 68 69 63 68 | 20 69 73 20 77 68 65 72 |*..which| is wher|
|00000230| 65 20 79 6f 75 20 77 69 | 6c 6c 2c 20 67 75 65 73 |e you wi|ll, gues|
|00000240| 73 20 77 68 61 74 2c 20 | 64 6f 20 79 6f 75 72 20 |s what, |do your |
|00000250| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 73 70 65 63 |applicat|ion spec|
|00000260| 69 66 69 63 20 70 72 6f | 63 65 73 73 69 6e 67 0d |ific pro|cessing.|
|00000270| 20 2a 09 09 6f 66 20 74 | 68 65 20 63 67 69 20 73 | *..of t|he cgi s|
|00000280| 74 75 66 66 2e 0d 20 2a | 0d 20 2a 09 44 6f 20 6e |tuff.. *|. *.Do n|
|00000290| 6f 74 20 63 61 6c 6c 20 | 61 6e 79 20 66 75 6e 63 |ot call |any func|
|000002a0| 74 69 6f 6e 73 20 62 65 | 67 69 6e 69 6e 67 20 77 |tions be|gining w|
|000002b0| 69 74 68 20 6c 6f 77 65 | 72 20 63 61 73 65 20 27 |ith lowe|r case '|
|000002c0| 63 67 69 27 20 2d 20 79 | 6f 75 20 63 61 6e 20 75 |cgi' - y|ou can u|
|000002d0| 73 65 20 61 6e 79 20 6f | 66 20 74 68 65 0d 20 2a |se any o|f the. *|
|000002e0| 09 6f 74 68 65 72 73 20 | 2d 20 62 75 74 20 72 65 |.others |- but re|
|000002f0| 61 64 20 74 68 65 69 72 | 20 63 6f 6d 6d 65 6e 74 |ad their| comment|
|00000300| 73 20 66 69 72 73 74 20 | 66 6f 72 20 64 65 74 61 |s first |for deta|
|00000310| 69 6c 73 2e 0d 20 2a 0d | 20 2a 09 77 61 74 63 68 |ils.. *.| *.watch|
|00000320| 20 74 68 65 20 68 6f 6d | 65 70 61 67 65 20 66 6f | the hom|epage fo|
|00000330| 72 20 66 75 74 75 72 65 | 20 75 70 67 72 61 64 65 |r future| upgrade|
|00000340| 73 0d 20 2a 0d 20 2a 09 | 6e 6f 74 69 63 65 20 6f |s. *. *.|notice o|
|00000350| 66 20 75 70 67 72 61 64 | 65 73 20 77 69 6c 6c 20 |f upgrad|es will |
|00000360| 62 65 20 70 6f 73 74 65 | 64 20 74 6f 20 6d 61 63 |be poste|d to mac|
|00000370| 77 77 77 74 6f 6f 6c 40 | 61 72 70 70 31 2e 63 61 |wwwtool@|arpp1.ca|
|00000380| 72 65 6c 74 6f 6e 2e 63 | 61 0d 20 2a 09 09 73 65 |relton.c|a. *..se|
|00000390| 65 20 68 74 74 70 3a 2f | 2f 61 72 70 70 31 2e 63 |e http:/|/arpp1.c|
|000003a0| 61 72 6c 65 74 6f 6e 2e | 63 61 2f 6c 69 73 74 2f |arleton.|ca/list/|
|000003b0| 6d 61 63 77 77 77 74 6f | 6f 6c 2e 68 74 6d 6c 20 |macwwwto|ol.html |
|000003c0| 66 6f 72 20 64 65 74 61 | 69 6c 73 0d 20 2a 0d 20 |for deta|ils. *. |
|000003d0| 2a 0d 20 2a 09 43 6f 70 | 79 72 69 67 68 74 20 a9 |*. *.Cop|yright .|
|000003e0| 31 39 39 35 20 62 79 20 | 47 72 61 6e 74 20 4e 65 |1995 by |Grant Ne|
|000003f0| 75 66 65 6c 64 0d 20 2a | 0d 20 2a 09 68 74 74 70 |ufeld. *|. *.http|
|00000400| 3a 2f 2f 61 72 70 70 31 | 2e 63 61 72 6c 65 74 6f |://arpp1|.carleto|
|00000410| 6e 2e 63 61 2f 67 72 61 | 6e 74 2f 0d 20 2a 09 67 |n.ca/gra|nt/. *.g|
|00000420| 6e 65 75 66 65 6c 64 40 | 63 63 73 2e 63 61 72 6c |neufeld@|ccs.carl|
|00000430| 65 74 6f 6e 2e 63 61 0d | 20 2a 09 67 72 61 6e 74 |eton.ca.| *.grant|
|00000440| 40 61 63 6d 2e 6f 72 67 | 0d 20 2a 0d 20 2a 09 54 |@acm.org|. *. *.T|
|00000450| 68 69 73 20 73 6f 75 72 | 63 65 20 6d 61 79 20 62 |his sour|ce may b|
|00000460| 65 20 66 72 65 65 6c 79 | 20 75 73 65 64 20 61 73 |e freely| used as|
|00000470| 20 6c 6f 6e 67 20 61 73 | 20 74 68 65 20 63 6f 70 | long as| the cop|
|00000480| 79 72 69 67 68 74 20 6e | 6f 74 69 63 65 20 69 73 |yright n|otice is|
|00000490| 20 6b 65 70 74 20 69 6e | 20 74 68 65 20 73 6f 75 | kept in| the sou|
|000004a0| 72 63 65 2e 0d 20 2a 09 | 49 20 61 73 6b 20 74 68 |rce.. *.|I ask th|
|000004b0| 61 74 20 79 6f 75 20 6c | 65 74 20 6d 65 20 6b 6e |at you l|et me kn|
|000004c0| 6f 77 20 6f 66 20 61 6e | 79 20 65 6e 68 61 6e 63 |ow of an|y enhanc|
|000004d0| 65 6d 65 6e 74 73 20 28 | 72 65 61 64 3a 20 62 75 |ements (|read: bu|
|000004e0| 67 20 66 69 78 65 73 29 | 20 74 6f 20 74 68 69 73 |g fixes)| to this|
|000004f0| 20 63 6f 64 65 2e 0d 20 | 2a 09 49 20 77 6f 75 6c | code.. |*.I woul|
|00000500| 64 20 61 6c 73 6f 20 6c | 69 6b 65 20 63 6f 70 69 |d also l|ike copi|
|00000510| 65 73 20 6f 66 20 28 6f | 72 20 64 69 73 63 6f 75 |es of (o|r discou|
|00000520| 6e 74 73 20 6f 6e 29 20 | 61 6e 79 74 68 69 6e 67 |nts on) |anything|
|00000530| 20 79 6f 75 20 70 72 6f | 64 75 63 65 20 74 68 69 | you pro|duce thi|
|00000540| 73 20 77 69 74 68 2c 20 | 70 6c 65 61 73 65 2e 0d |s with, |please..|
|00000550| 20 2a 0d 20 2a 09 53 65 | 65 20 74 68 65 20 4c 69 | *. *.Se|e the Li|
|00000560| 63 65 6e 73 65 20 61 6e | 64 20 4c 69 6d 69 74 65 |cense an|d Limite|
|00000570| 64 20 57 61 72 72 61 6e | 74 79 20 41 67 72 65 65 |d Warran|ty Agree|
|00000580| 6d 65 6e 74 20 66 6f 72 | 20 61 6c 6c 20 74 68 65 |ment for| all the|
|00000590| 20 6c 65 67 61 6c 20 73 | 74 75 66 66 2e 0d 20 2a | legal s|tuff.. *|
|000005a0| 0d 20 2a 2a 2a 2a 2a 2f | 0d 0d 23 69 6e 63 6c 75 |. *****/|..#inclu|
|000005b0| 64 65 20 22 4d 79 43 6f | 6e 66 69 67 75 72 61 74 |de "MyCo|nfigurat|
|000005c0| 69 6f 6e 2e 68 22 0d 23 | 69 66 20 6b 43 6f 6d 70 |ion.h".#|if kComp|
|000005d0| 69 6c 65 57 69 74 68 43 | 47 49 43 6f 64 65 0d 0d |ileWithC|GICode..|
|000005e0| 23 69 6e 63 6c 75 64 65 | 20 3c 73 74 72 69 6e 67 |#include| <string|
|000005f0| 2e 68 3e 0d 0d 23 69 6e | 63 6c 75 64 65 20 22 63 |.h>..#in|clude "c|
|00000600| 6f 6d 70 69 6c 65 72 5f | 73 74 75 66 66 2e 68 22 |ompiler_|stuff.h"|
|00000610| 0d 23 69 6e 63 6c 75 64 | 65 20 22 67 6c 6f 62 61 |.#includ|e "globa|
|00000620| 6c 73 2e 68 22 0d 0d 23 | 69 6e 63 6c 75 64 65 20 |ls.h"..#|include |
|00000630| 22 41 45 46 75 6e 63 2e | 68 22 0d 23 69 6e 63 6c |"AEFunc.|h".#incl|
|00000640| 75 64 65 20 22 44 65 62 | 75 67 55 74 69 6c 2e 68 |ude "Deb|ugUtil.h|
|00000650| 22 0d 23 69 6e 63 6c 75 | 64 65 20 22 4d 65 6d 6f |".#inclu|de "Memo|
|00000660| 72 79 55 74 69 6c 2e 68 | 22 0d 23 69 6e 63 6c 75 |ryUtil.h|".#inclu|
|00000670| 64 65 20 22 50 72 6f 63 | 65 73 73 55 74 69 6c 2e |de "Proc|essUtil.|
|00000680| 68 22 0d 23 69 6e 63 6c | 75 64 65 20 22 51 75 69 |h".#incl|ude "Qui|
|00000690| 74 2e 68 22 0d 23 69 6e | 63 6c 75 64 65 20 22 53 |t.h".#in|clude "S|
|000006a0| 74 72 69 6e 67 55 74 69 | 6c 2e 68 22 0d 0d 2f 2a |tringUti|l.h"../*|
|000006b0| 20 43 47 49 2e 68 20 70 | 72 6f 63 65 73 73 65 73 | CGI.h p|rocesses|
|000006c0| 20 64 69 66 66 65 72 65 | 6e 74 6c 79 20 66 6f 72 | differe|ntly for|
|000006d0| 20 43 47 49 2e 63 2c 20 | 74 68 69 73 20 69 73 20 | CGI.c, |this is |
|000006e0| 63 6f 6e 74 72 6f 6c 6c | 65 64 20 62 79 20 64 65 |controll|ed by de|
|000006f0| 66 69 6e 69 6e 67 20 5f | 5f 43 47 49 53 65 67 6d |fining _|_CGISegm|
|00000700| 65 6e 74 5f 5f 20 2a 2f | 0d 23 64 65 66 69 6e 65 |ent__ */|.#define|
|00000710| 20 5f 5f 43 47 49 53 65 | 67 6d 65 6e 74 5f 5f 09 | __CGISe|gment__.|
|00000720| 31 0d 23 69 6e 63 6c 75 | 64 65 20 22 43 47 49 2e |1.#inclu|de "CGI.|
|00000730| 68 22 0d 23 75 6e 64 65 | 66 09 5f 5f 43 47 49 53 |h".#unde|f.__CGIS|
|00000740| 65 67 6d 65 6e 74 5f 5f | 0d 0d 0d 2f 2a 2a 2a 20 |egment__|.../*** |
|00000750| 20 43 4f 4e 53 54 41 4e | 54 20 44 45 43 4c 41 52 | CONSTAN|T DECLAR|
|00000760| 41 54 49 4f 4e 53 20 20 | 2a 2a 2a 2f 0d 0d 23 64 |ATIONS |***/..#d|
|00000770| 65 66 69 6e 65 20 6b 48 | 54 54 50 48 65 61 64 65 |efine kH|TTPHeade|
|00000780| 72 53 74 72 73 09 09 33 | 30 30 30 0d 23 64 65 66 |rStrs..3|000.#def|
|00000790| 69 6e 65 20 6b 48 54 54 | 50 48 65 61 64 65 72 4f |ine kHTT|PHeaderO|
|000007a0| 4b 09 09 31 0d 23 64 65 | 66 69 6e 65 20 6b 48 54 |K..1.#de|fine kHT|
|000007b0| 54 50 48 65 61 64 65 72 | 52 65 64 69 72 65 63 74 |TPHeader|Redirect|
|000007c0| 09 32 0d 23 64 65 66 69 | 6e 65 20 6b 48 54 54 50 |.2.#defi|ne kHTTP|
|000007d0| 48 65 61 64 65 72 45 72 | 72 09 09 33 0d 23 64 65 |HeaderEr|r..3.#de|
|000007e0| 66 69 6e 65 20 6b 48 54 | 54 50 48 65 61 64 65 72 |fine kHT|TPHeader|
|000007f0| 50 75 73 68 09 09 34 0d | 0d 0d 2f 2a 2a 2a 20 20 |Push..4.|../*** |
|00000800| 4c 4f 43 41 4c 20 56 41 | 52 49 41 42 4c 45 53 20 |LOCAL VA|RIABLES |
|00000810| 20 2a 2a 2a 2f 0d 0d 23 | 69 66 20 6b 43 6f 6d 70 | ***/..#|if kComp|
|00000820| 69 6c 65 57 69 74 68 54 | 68 72 65 61 64 65 64 41 |ileWithT|hreadedA|
|00000830| 70 70 6c 65 45 76 65 6e | 74 73 0d 73 74 61 74 69 |ppleEven|ts.stati|
|00000840| 63 20 41 45 45 76 65 6e | 74 48 61 6e 64 6c 65 72 |c AEEven|tHandler|
|00000850| 55 50 50 09 76 43 47 49 | 41 45 52 65 73 75 6d 65 |UPP.vCGI|AEResume|
|00000860| 43 6f 6d 70 6c 65 74 65 | 55 50 50 3b 0d 23 65 6e |Complete|UPP;.#en|
|00000870| 64 69 66 0d 0d 73 74 61 | 74 69 63 20 63 68 61 72 |dif..sta|tic char|
|00000880| 20 2a 09 09 09 09 76 4e | 55 4c 4c 53 74 72 69 6e | *....vN|ULLStrin|
|00000890| 67 3b 0d 0d 0d 2f 2a 2a | 2a 20 20 4c 4f 43 41 4c |g;.../**|* LOCAL|
|000008a0| 20 46 55 4e 43 54 49 4f | 4e 20 50 52 4f 54 4f 54 | FUNCTIO|N PROTOT|
|000008b0| 59 50 45 53 20 20 2a 2a | 2a 2f 0d 0d 73 74 61 74 |YPES **|*/..stat|
|000008c0| 69 63 09 76 6f 69 64 09 | 63 67 69 44 69 73 70 6f |ic.void.|cgiDispo|
|000008d0| 73 65 48 61 6e 64 6c 65 | 09 09 09 28 20 43 47 49 |seHandle|...( CGI|
|000008e0| 48 64 6c 20 29 3b 0d 0d | 73 74 61 74 69 63 20 4f |Hdl );..|static O|
|000008f0| 53 45 72 72 09 63 67 69 | 41 45 53 65 61 72 63 68 |SErr.cgi|AESearch|
|00000900| 44 6f 63 50 72 6f 63 65 | 73 73 09 09 28 20 43 47 |DocProce|ss..( CG|
|00000910| 49 48 64 6c 20 29 3b 0d | 73 74 61 74 69 63 20 4f |IHdl );.|static O|
|00000920| 53 45 72 72 09 63 67 69 | 41 45 43 6f 6d 70 6c 65 |SErr.cgi|AEComple|
|00000930| 74 65 09 09 09 09 28 20 | 43 47 49 48 64 6c 20 29 |te....( |CGIHdl )|
|00000940| 3b 0d 0d 23 69 66 20 6b | 43 6f 6d 70 69 6c 65 57 |;..#if k|CompileW|
|00000950| 69 74 68 54 68 72 65 61 | 64 65 64 41 70 70 6c 65 |ithThrea|dedApple|
|00000960| 45 76 65 6e 74 73 0d 70 | 61 73 63 61 6c 20 76 6f |Events.p|ascal vo|
|00000970| 69 64 20 2a 09 43 47 49 | 41 45 53 65 61 72 63 68 |id *.CGI|AESearch|
|00000980| 44 6f 63 50 72 6f 63 65 | 73 73 54 68 72 65 61 64 |DocProce|ssThread|
|00000990| 09 28 20 76 6f 69 64 20 | 2a 20 29 3b 0d 70 61 73 |.( void |* );.pas|
|000009a0| 63 61 6c 20 4f 53 45 72 | 72 09 43 47 49 41 45 52 |cal OSEr|r.CGIAER|
|000009b0| 65 73 75 6d 65 43 6f 6d | 70 6c 65 74 65 09 09 09 |esumeCom|plete...|
|000009c0| 28 20 63 6f 6e 73 74 20 | 41 70 70 6c 65 45 76 65 |( const |AppleEve|
|000009d0| 6e 74 20 2a 2c 20 41 70 | 70 6c 65 45 76 65 6e 74 |nt *, Ap|pleEvent|
|000009e0| 20 2a 2c 20 6c 6f 6e 67 | 20 29 3b 0d 23 65 6e 64 | *, long| );.#end|
|000009f0| 69 66 0d 0d 23 69 66 20 | 6b 43 6f 6d 70 69 6c 65 |if..#if |kCompile|
|00000a00| 57 69 74 68 43 47 49 6d | 65 74 68 6f 64 0d 73 74 |WithCGIm|ethod.st|
|00000a10| 61 74 69 63 09 4f 53 45 | 72 72 09 63 67 69 41 45 |atic.OSE|rr.cgiAE|
|00000a20| 47 65 74 50 61 72 61 6d | 48 54 54 50 4d 65 74 68 |GetParam|HTTPMeth|
|00000a30| 6f 64 09 09 28 20 63 6f | 6e 73 74 20 41 70 70 6c |od..( co|nst Appl|
|00000a40| 65 45 76 65 6e 74 20 2a | 2c 20 41 45 4b 65 79 77 |eEvent *|, AEKeyw|
|00000a50| 6f 72 64 2c 20 48 54 54 | 50 4d 65 74 68 6f 64 20 |ord, HTT|PMethod |
|00000a60| 2a 2c 20 63 68 61 72 20 | 2a 2c 20 6c 6f 6e 67 20 |*, char |*, long |
|00000a70| 29 3b 0d 23 65 6e 64 69 | 66 0d 0d 0d 2f 2a 2a 2a |);.#endi|f.../***|
|00000a80| 20 20 46 55 4e 43 54 49 | 4f 4e 53 20 20 2a 2a 2a | FUNCTI|ONS ***|
|00000a90| 2f 0d 0d 2f 2a 20 54 68 | 69 73 20 69 6e 69 74 69 |/../* Th|is initi|
|00000aa0| 61 6c 69 7a 61 74 69 6f | 6e 20 66 75 6e 63 74 69 |alizatio|n functi|
|00000ab0| 6f 6e 20 4d 55 53 54 20 | 62 65 20 63 61 6c 6c 65 |on MUST |be calle|
|00000ac0| 64 20 69 6e 20 74 68 65 | 20 73 74 61 72 74 75 70 |d in the| startup|
|00000ad0| 20 73 65 71 75 65 6e 63 | 65 20 6f 66 20 79 6f 75 | sequenc|e of you|
|00000ae0| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 2a 2f |r applic|ation */|
|00000af0| 0d 4f 53 45 72 72 0d 49 | 6e 69 74 43 47 49 55 74 |.OSErr.I|nitCGIUt|
|00000b00| 69 6c 20 28 20 76 6f 69 | 64 20 29 0d 7b 0d 09 4f |il ( voi|d ).{..O|
|00000b10| 53 45 72 72 09 09 09 09 | 74 68 65 45 72 72 3b 0d |SErr....|theErr;.|
|00000b20| 09 41 45 45 76 65 6e 74 | 48 61 6e 64 6c 65 72 55 |.AEEvent|HandlerU|
|00000b30| 50 50 09 74 68 65 55 50 | 50 3b 0d 09 0d 09 2f 2a |PP.theUP|P;..../*|
|00000b40| 20 69 6e 69 74 69 61 6c | 69 7a 65 20 74 68 65 20 | initial|ize the |
|00000b50| 6e 75 6c 6c 20 73 74 72 | 69 6e 67 20 74 6f 20 63 |null str|ing to c|
|00000b60| 6f 6e 73 69 73 74 20 6f | 66 20 6f 6e 65 20 63 68 |onsist o|f one ch|
|00000b70| 61 72 61 63 74 65 72 20 | 27 5c 30 27 20 2a 2f 0d |aracter |'\0' */.|
|00000b80| 09 76 4e 55 4c 4c 53 74 | 72 69 6e 67 20 3d 20 28 |.vNULLSt|ring = (|
|00000b90| 63 68 61 72 20 2a 29 20 | 4d 79 4e 65 77 50 74 72 |char *) |MyNewPtr|
|00000ba0| 20 28 20 31 2c 20 26 74 | 68 65 45 72 72 20 29 3b | ( 1, &t|heErr );|
|00000bb0| 0d 09 69 66 20 28 20 76 | 4e 55 4c 4c 53 74 72 69 |..if ( v|NULLStri|
|00000bc0| 6e 67 20 21 3d 20 6e 69 | 6c 20 29 0d 09 7b 0d 09 |ng != ni|l )..{..|
|00000bd0| 09 76 4e 55 4c 4c 53 74 | 72 69 6e 67 5b 30 5d 20 |.vNULLSt|ring[0] |
|00000be0| 3d 20 6e 69 6c 3b 0d 09 | 7d 0d 09 65 6c 73 65 0d |= nil;..|}..else.|
|00000bf0| 09 7b 0d 09 09 2f 2a 20 | 49 4d 50 4f 52 54 41 4e |.{.../* |IMPORTAN|
|00000c00| 54 3a 20 77 65 20 66 61 | 69 6c 65 64 20 69 6e 69 |T: we fa|iled ini|
|00000c10| 74 69 61 6c 69 7a 61 74 | 69 6f 6e 0d 09 09 09 69 |tializat|ion....i|
|00000c20| 66 20 77 65 20 63 6f 75 | 6c 64 6e 27 74 20 61 6c |f we cou|ldn't al|
|00000c30| 6c 6f 63 61 74 65 20 61 | 20 6f 6e 65 20 62 79 74 |locate a| one byt|
|00000c40| 65 20 73 74 72 69 6e 67 | 21 20 2a 2f 0d 09 09 69 |e string|! */...i|
|00000c50| 66 20 28 20 74 68 65 45 | 72 72 20 3d 3d 20 6e 6f |f ( theE|rr == no|
|00000c60| 45 72 72 20 29 0d 09 09 | 7b 0d 09 09 09 2f 2a 20 |Err )...|{..../* |
|00000c70| 6d 61 6b 65 20 73 75 72 | 65 20 74 68 65 72 65 27 |make sur|e there'|
|00000c80| 73 20 61 6e 20 65 72 72 | 6f 72 20 76 61 6c 75 65 |s an err|or value|
|00000c90| 20 2a 2f 0d 09 09 09 74 | 68 65 45 72 72 20 3d 20 | */....t|heErr = |
|00000ca0| 6d 65 6d 46 75 6c 6c 45 | 72 72 3b 0d 09 09 7d 0d |memFullE|rr;...}.|
|00000cb0| 09 09 0d 09 09 72 65 74 | 75 72 6e 20 74 68 65 45 |.....ret|urn theE|
|00000cc0| 72 72 3b 0d 09 7d 0d 09 | 0d 09 47 65 74 49 6e 64 |rr;..}..|..GetInd|
|00000cd0| 53 74 72 69 6e 67 20 28 | 20 67 48 54 54 50 48 65 |String (| gHTTPHe|
|00000ce0| 61 64 65 72 4f 4b 2c 20 | 6b 48 54 54 50 48 65 61 |aderOK, |kHTTPHea|
|00000cf0| 64 65 72 53 74 72 73 2c | 20 6b 48 54 54 50 48 65 |derStrs,| kHTTPHe|
|00000d00| 61 64 65 72 4f 4b 20 29 | 3b 0d 09 69 66 20 28 20 |aderOK )|;..if ( |
|00000d10| 67 48 54 54 50 48 65 61 | 64 65 72 4f 4b 20 21 3d |gHTTPHea|derOK !=|
|00000d20| 20 6e 69 6c 20 29 0d 09 | 7b 0d 09 09 50 32 43 53 | nil )..|{...P2CS|
|00000d30| 74 72 20 28 20 67 48 54 | 54 50 48 65 61 64 65 72 |tr ( gHT|TPHeader|
|00000d40| 4f 4b 20 29 3b 0d 09 09 | 67 48 54 54 50 48 65 61 |OK );...|gHTTPHea|
|00000d50| 64 65 72 4f 4b 53 69 7a | 65 20 3d 20 73 74 72 6c |derOKSiz|e = strl|
|00000d60| 65 6e 20 28 20 28 63 68 | 61 72 20 2a 29 67 48 54 |en ( (ch|ar *)gHT|
|00000d70| 54 50 48 65 61 64 65 72 | 4f 4b 20 29 3b 0d 09 7d |TPHeader|OK );..}|
|00000d80| 0d 09 0d 09 47 65 74 49 | 6e 64 53 74 72 69 6e 67 |....GetI|ndString|
|00000d90| 20 28 20 67 48 54 54 50 | 48 65 61 64 65 72 52 65 | ( gHTTP|HeaderRe|
|00000da0| 64 69 72 65 63 74 2c 20 | 6b 48 54 54 50 48 65 61 |direct, |kHTTPHea|
|00000db0| 64 65 72 53 74 72 73 2c | 20 6b 48 54 54 50 48 65 |derStrs,| kHTTPHe|
|00000dc0| 61 64 65 72 52 65 64 69 | 72 65 63 74 20 29 3b 0d |aderRedi|rect );.|
|00000dd0| 09 69 66 20 28 20 67 48 | 54 54 50 48 65 61 64 65 |.if ( gH|TTPHeade|
|00000de0| 72 52 65 64 69 72 65 63 | 74 20 21 3d 20 6e 69 6c |rRedirec|t != nil|
|00000df0| 20 29 0d 09 7b 0d 09 09 | 50 32 43 53 74 72 20 28 | )..{...|P2CStr (|
|00000e00| 20 67 48 54 54 50 48 65 | 61 64 65 72 52 65 64 69 | gHTTPHe|aderRedi|
|00000e10| 72 65 63 74 20 29 3b 0d | 09 09 67 48 54 54 50 48 |rect );.|..gHTTPH|
|00000e20| 65 61 64 65 72 52 65 64 | 69 72 65 63 74 53 69 7a |eaderRed|irectSiz|
|00000e30| 65 20 3d 20 73 74 72 6c | 65 6e 20 28 20 28 63 68 |e = strl|en ( (ch|
|00000e40| 61 72 20 2a 29 67 48 54 | 54 50 48 65 61 64 65 72 |ar *)gHT|TPHeader|
|00000e50| 52 65 64 69 72 65 63 74 | 20 29 3b 0d 09 7d 0d 09 |Redirect| );..}..|
|00000e60| 0d 09 47 65 74 49 6e 64 | 53 74 72 69 6e 67 20 28 |..GetInd|String (|
|00000e70| 20 67 48 54 54 50 48 65 | 61 64 65 72 45 72 72 2c | gHTTPHe|aderErr,|
|00000e80| 20 6b 48 54 54 50 48 65 | 61 64 65 72 53 74 72 73 | kHTTPHe|aderStrs|
|00000e90| 2c 20 6b 48 54 54 50 48 | 65 61 64 65 72 45 72 72 |, kHTTPH|eaderErr|
|00000ea0| 20 29 3b 0d 09 69 66 20 | 28 20 67 48 54 54 50 48 | );..if |( gHTTPH|
|00000eb0| 65 61 64 65 72 45 72 72 | 20 21 3d 20 6e 69 6c 20 |eaderErr| != nil |
|00000ec0| 29 0d 09 7b 0d 09 09 50 | 32 43 53 74 72 20 28 20 |)..{...P|2CStr ( |
|00000ed0| 67 48 54 54 50 48 65 61 | 64 65 72 45 72 72 20 29 |gHTTPHea|derErr )|
|00000ee0| 3b 0d 09 09 67 48 54 54 | 50 48 65 61 64 65 72 45 |;...gHTT|PHeaderE|
|00000ef0| 72 72 53 69 7a 65 20 3d | 20 73 74 72 6c 65 6e 20 |rrSize =| strlen |
|00000f00| 28 20 28 63 68 61 72 20 | 2a 29 67 48 54 54 50 48 |( (char |*)gHTTPH|
|00000f10| 65 61 64 65 72 45 72 72 | 20 29 3b 0d 09 7d 0d 09 |eaderErr| );..}..|
|00000f20| 0d 09 23 69 66 20 6b 43 | 6f 6d 70 69 6c 65 57 69 |..#if kC|ompileWi|
|00000f30| 74 68 43 47 49 53 65 6e | 64 50 61 72 74 69 61 6c |thCGISen|dPartial|
|00000f40| 0d 09 47 65 74 49 6e 64 | 53 74 72 69 6e 67 20 28 |..GetInd|String (|
|00000f50| 20 67 48 54 54 50 48 65 | 61 64 65 72 50 75 73 68 | gHTTPHe|aderPush|
|00000f60| 2c 20 6b 48 54 54 50 48 | 65 61 64 65 72 53 74 72 |, kHTTPH|eaderStr|
|00000f70| 73 2c 20 6b 48 54 54 50 | 48 65 61 64 65 72 50 75 |s, kHTTP|HeaderPu|
|00000f80| 73 68 20 29 3b 0d 09 69 | 66 20 28 20 67 48 54 54 |sh );..i|f ( gHTT|
|00000f90| 50 48 65 61 64 65 72 50 | 75 73 68 20 21 3d 20 6e |PHeaderP|ush != n|
|00000fa0| 69 6c 20 29 0d 09 7b 0d | 09 09 50 32 43 53 74 72 |il )..{.|..P2CStr|
|00000fb0| 20 28 20 67 48 54 54 50 | 48 65 61 64 65 72 50 75 | ( gHTTP|HeaderPu|
|00000fc0| 73 68 20 29 3b 0d 09 09 | 67 48 54 54 50 48 65 61 |sh );...|gHTTPHea|
|00000fd0| 64 65 72 50 75 73 68 53 | 69 7a 65 20 3d 20 73 74 |derPushS|ize = st|
|00000fe0| 72 6c 65 6e 20 28 20 28 | 63 68 61 72 20 2a 29 67 |rlen ( (|char *)g|
|00000ff0| 48 54 54 50 48 65 61 64 | 65 72 50 75 73 68 20 29 |HTTPHead|erPush )|
|00001000| 3b 0d 09 7d 0d 09 23 65 | 6e 64 69 66 0d 09 0d 09 |;..}..#e|ndif....|
|00001010| 74 68 65 55 50 50 09 3d | 20 4e 65 77 41 45 45 76 |theUPP.=| NewAEEv|
|00001020| 65 6e 74 48 61 6e 64 6c | 65 72 50 72 6f 63 20 28 |entHandl|erProc (|
|00001030| 20 43 47 49 41 45 53 65 | 61 72 63 68 44 6f 63 20 | CGIAESe|archDoc |
|00001040| 29 3b 0d 09 74 68 65 45 | 72 72 09 3d 20 41 45 49 |);..theE|rr.= AEI|
|00001050| 6e 73 74 61 6c 6c 45 76 | 65 6e 74 48 61 6e 64 6c |nstallEv|entHandl|
|00001060| 65 72 20 28 20 6b 41 45 | 43 6c 61 73 73 43 47 49 |er ( kAE|ClassCGI|
|00001070| 2c 20 6b 41 45 49 44 53 | 65 61 72 63 68 44 6f 63 |, kAEIDS|earchDoc|
|00001080| 2c 20 74 68 65 55 50 50 | 2c 20 30 4c 2c 20 66 61 |, theUPP|, 0L, fa|
|00001090| 6c 73 65 20 29 3b 0d 09 | 0d 09 23 69 66 20 6b 43 |lse );..|..#if kC|
|000010a0| 6f 6d 70 69 6c 65 57 69 | 74 68 54 68 72 65 61 64 |ompileWi|thThread|
|000010b0| 65 64 41 70 70 6c 65 45 | 76 65 6e 74 73 0d 09 76 |edAppleE|vents..v|
|000010c0| 43 47 49 41 45 52 65 73 | 75 6d 65 43 6f 6d 70 6c |CGIAERes|umeCompl|
|000010d0| 65 74 65 55 50 50 20 3d | 20 4e 65 77 41 45 45 76 |eteUPP =| NewAEEv|
|000010e0| 65 6e 74 48 61 6e 64 6c | 65 72 50 72 6f 63 20 28 |entHandl|erProc (|
|000010f0| 20 43 47 49 41 45 52 65 | 73 75 6d 65 43 6f 6d 70 | CGIAERe|sumeComp|
|00001100| 6c 65 74 65 20 29 3b 0d | 09 23 65 6e 64 69 66 0d |lete );.|.#endif.|
|00001110| 09 0d 09 72 65 74 75 72 | 6e 20 74 68 65 45 72 72 |...retur|n theErr|
|00001120| 3b 0d 7d 20 2f 2a 20 49 | 6e 69 74 43 47 49 55 74 |;.} /* I|nitCGIUt|
|00001130| 69 6c 20 2a 2f 0d 0d 0d | 2f 2a 2a 20 20 46 4f 52 |il */...|/** FOR|
|00001140| 4d 20 46 49 45 4c 44 53 | 20 20 2a 2a 2f 0d 23 70 |M FIELDS| **/.#p|
|00001150| 72 61 67 6d 61 20 6d 61 | 72 6b 20 2d 0d 23 69 66 |ragma ma|rk -.#if|
|00001160| 20 6b 43 6f 6d 70 69 6c | 65 57 69 74 68 43 47 49 | kCompil|eWithCGI|
|00001170| 46 6f 72 6d 48 61 6e 64 | 6c 69 6e 67 0d 0d 2f 2a |FormHand|ling../*|
|00001180| 20 54 68 65 20 73 65 70 | 61 72 61 74 6f 72 20 27 | The sep|arator '|
|00001190| 26 27 20 73 65 70 61 72 | 61 74 65 73 20 69 6e 64 |&' separ|ates ind|
|000011a0| 69 76 69 64 75 61 6c 20 | 66 69 65 6c 64 73 2e 0d |ividual |fields..|
|000011b0| 09 54 68 65 20 64 65 6c | 69 6d 69 74 65 72 20 27 |.The del|imiter '|
|000011c0| 3d 27 20 64 65 6c 69 6d | 69 74 73 20 74 68 65 20 |=' delim|its the |
|000011d0| 6e 61 6d 65 20 61 6e 64 | 20 76 61 6c 75 65 20 69 |name and| value i|
|000011e0| 6e 20 61 20 66 69 65 6c | 64 2e 0d 09 46 6f 72 20 |n a fiel|d...For |
|000011f0| 65 78 61 6d 70 6c 65 3a | 20 22 46 69 65 6c 64 20 |example:| "Field |
|00001200| 31 3d 73 6f 6d 65 20 73 | 74 75 66 66 26 41 6e 6f |1=some s|tuff&Ano|
|00001210| 74 68 65 72 20 46 69 65 | 6c 64 3d 6d 6f 72 65 20 |ther Fie|ld=more |
|00001220| 73 74 75 66 66 26 4c 61 | 73 74 20 46 69 65 6c 64 |stuff&La|st Field|
|00001230| 3d 6e 6f 20 73 74 75 66 | 66 22 0d 09 4d 65 61 6e |=no stuf|f"..Mean|
|00001240| 73 20 74 68 61 74 20 74 | 68 65 72 65 20 61 72 65 |s that t|here are|
|00001250| 20 33 20 66 69 65 6c 64 | 73 20 77 69 74 68 20 6e | 3 field|s with n|
|00001260| 61 6d 65 73 20 22 46 69 | 65 6c 64 20 31 22 2c 20 |ames "Fi|eld 1", |
|00001270| 22 41 6e 6f 74 68 65 72 | 20 46 69 65 6c 64 22 20 |"Another| Field" |
|00001280| 61 6e 64 20 22 4c 61 73 | 74 20 46 69 65 6c 64 22 |and "Las|t Field"|
|00001290| 0d 09 0d 09 54 68 65 20 | 66 75 6e 63 74 69 6f 6e |....The |function|
|000012a0| 20 72 65 74 75 72 6e 73 | 20 61 6e 20 61 72 72 61 | returns| an arra|
|000012b0| 79 20 6f 66 20 66 69 65 | 6c 64 20 72 65 63 6f 72 |y of fie|ld recor|
|000012c0| 64 73 20 77 69 74 68 20 | 74 68 65 20 6c 61 73 74 |ds with |the last|
|000012d0| 20 63 6f 6e 74 61 69 6e | 69 6e 67 20 6e 75 6c 6c | contain|ing null|
|000012e0| 20 76 61 6c 75 65 73 2e | 0d 09 0d 09 59 6f 75 20 | values.|....You |
|000012f0| 67 65 6e 65 72 61 6c 6c | 79 20 73 68 6f 75 6c 64 |generall|y should|
|00001300| 6e 27 74 20 63 61 6c 6c | 20 74 68 69 73 20 66 75 |n't call| this fu|
|00001310| 6e 63 74 69 6f 6e 20 6f | 75 74 73 69 64 65 20 74 |nction o|utside t|
|00001320| 68 69 73 20 66 69 6c 65 | 2e 0d 09 55 73 65 20 69 |his file|...Use i|
|00001330| 74 20 61 74 20 79 6f 75 | 72 20 6f 77 6e 20 72 69 |t at you|r own ri|
|00001340| 73 6b 2e 20 2a 2f 0d 09 | 2f 2a 20 a5 a5 a5 20 49 |sk. */..|/* ... I|
|00001350| 20 73 68 6f 75 6c 64 20 | 61 64 64 20 65 72 72 6f | should |add erro|
|00001360| 72 20 72 65 70 6f 72 74 | 69 6e 67 20 2a 2f 0d 43 |r report|ing */.C|
|00001370| 47 49 46 6f 72 6d 46 69 | 65 6c 64 20 2a 0d 43 47 |GIFormFi|eld *.CG|
|00001380| 49 46 6f 72 6d 46 69 65 | 6c 64 73 46 72 6f 6d 41 |IFormFie|ldsFromA|
|00001390| 72 67 73 20 28 20 63 68 | 61 72 20 2a 74 68 65 53 |rgs ( ch|ar *theS|
|000013a0| 74 72 69 6e 67 2c 20 6c | 6f 6e 67 20 2a 63 6f 75 |tring, l|ong *cou|
|000013b0| 6e 74 2c 20 73 68 6f 72 | 74 20 2a 6f 75 74 45 72 |nt, shor|t *outEr|
|000013c0| 72 20 29 0d 7b 0d 09 43 | 47 49 46 6f 72 6d 46 69 |r ).{..C|GIFormFi|
|000013d0| 65 6c 64 20 2a 09 74 68 | 65 46 69 65 6c 64 73 3b |eld *.th|eFields;|
|000013e0| 0d 09 6c 6f 6e 67 09 09 | 09 74 6f 74 61 6c 53 74 |..long..|.totalSt|
|000013f0| 72 53 69 7a 65 3b 0d 09 | 6c 6f 6e 67 09 09 09 74 |rSize;..|long...t|
|00001400| 6f 74 61 6c 46 69 65 6c | 64 73 3b 0d 09 6c 6f 6e |otalFiel|ds;..lon|
|00001410| 67 09 09 09 6e 61 6d 65 | 53 69 7a 65 3b 0d 09 6c |g...name|Size;..l|
|00001420| 6f 6e 67 09 09 09 76 61 | 6c 75 65 53 69 7a 65 3b |ong...va|lueSize;|
|00001430| 0d 09 6c 6f 6e 67 09 09 | 09 63 75 72 72 65 6e 74 |..long..|.current|
|00001440| 46 69 65 6c 64 3b 0d 09 | 63 68 61 72 20 2a 09 09 |Field;..|char *..|
|00001450| 09 74 68 65 53 74 72 69 | 6e 67 50 74 72 3b 0d 09 |.theStri|ngPtr;..|
|00001460| 63 68 61 72 20 2a 09 09 | 09 66 69 65 6c 64 53 65 |char *..|.fieldSe|
|00001470| 70 61 72 61 74 6f 72 3b | 0d 09 63 68 61 72 20 2a |parator;|..char *|
|00001480| 09 09 09 66 69 65 6c 64 | 44 65 6c 69 6d 69 74 65 |...field|Delimite|
|00001490| 72 3b 0d 09 0d 09 6d 79 | 5f 61 73 73 65 72 74 20 |r;....my|_assert |
|000014a0| 28 20 74 68 65 53 74 72 | 69 6e 67 20 21 3d 20 6e |( theStr|ing != n|
|000014b0| 69 6c 2c 20 22 5c 70 43 | 47 49 46 6f 72 6d 41 72 |il, "\pC|GIFormAr|
|000014c0| 67 73 3a 20 6e 69 6c 20 | 73 74 72 69 6e 67 22 20 |gs: nil |string" |
|000014d0| 29 3b 0d 09 0d 09 74 68 | 65 46 69 65 6c 64 73 20 |);....th|eFields |
|000014e0| 3d 20 6e 69 6c 3b 0d 09 | 0d 09 2f 2a 20 64 6f 6e |= nil;..|../* don|
|000014f0| 27 74 20 72 65 74 75 72 | 6e 20 6e 75 6d 62 65 72 |'t retur|n number|
|00001500| 20 6f 66 20 66 69 65 6c | 64 73 20 75 6e 74 69 6c | of fiel|ds until|
|00001510| 20 66 75 6e 63 74 69 6f | 6e 20 69 73 20 73 75 63 | functio|n is suc|
|00001520| 63 65 73 73 66 75 6c 20 | 2a 2f 0d 09 2a 63 6f 75 |cessful |*/..*cou|
|00001530| 6e 74 09 09 09 3d 20 6e | 69 6c 3b 0d 09 0d 09 74 |nt...= n|il;....t|
|00001540| 6f 74 61 6c 53 74 72 53 | 69 7a 65 09 3d 20 73 74 |otalStrS|ize.= st|
|00001550| 72 6c 65 6e 20 28 20 74 | 68 65 53 74 72 69 6e 67 |rlen ( t|heString|
|00001560| 20 29 3b 0d 09 0d 09 2f | 2a 20 74 68 65 20 74 6f | );..../|* the to|
|00001570| 74 61 6c 20 6e 75 6d 62 | 65 72 20 6f 66 20 66 69 |tal numb|er of fi|
|00001580| 65 6c 64 73 20 69 73 20 | 74 68 65 20 6e 75 6d 62 |elds is |the numb|
|00001590| 65 72 20 6f 66 20 73 65 | 70 61 72 61 74 6f 72 20 |er of se|parator |
|000015a0| 63 68 61 72 61 63 74 65 | 72 73 20 2b 20 31 20 2a |characte|rs + 1 *|
|000015b0| 2f 0d 09 74 6f 74 61 6c | 46 69 65 6c 64 73 09 09 |/..total|Fields..|
|000015c0| 3d 20 53 74 72 69 6e 67 | 43 6f 75 6e 74 43 68 61 |= String|CountCha|
|000015d0| 72 20 28 20 74 68 65 53 | 74 72 69 6e 67 2c 20 6b |r ( theS|tring, k|
|000015e0| 43 47 49 46 6f 72 6d 46 | 69 65 6c 64 53 65 70 61 |CGIFormF|ieldSepa|
|000015f0| 72 61 74 6f 72 20 29 20 | 2b 20 31 3b 0d 09 0d 09 |rator ) |+ 1;....|
|00001600| 69 66 20 28 20 74 6f 74 | 61 6c 46 69 65 6c 64 73 |if ( tot|alFields|
|00001610| 20 3d 3d 20 31 20 29 0d | 09 7b 0d 09 09 2f 2a 20 | == 1 ).|.{.../* |
|00001620| 74 68 65 20 63 61 73 65 | 20 77 68 65 72 65 20 74 |the case| where t|
|00001630| 68 65 72 65 20 77 65 72 | 65 20 6e 6f 20 73 65 70 |here wer|e no sep|
|00001640| 61 72 61 74 6f 72 20 63 | 68 61 72 61 63 74 65 72 |arator c|haracter|
|00001650| 73 20 69 73 20 73 70 65 | 63 69 61 6c 2c 0d 09 09 |s is spe|cial,...|
|00001660| 09 74 65 73 74 20 66 6f | 72 20 61 20 66 69 65 6c |.test fo|r a fiel|
|00001670| 64 20 64 65 6c 69 6d 69 | 74 65 72 20 74 6f 20 63 |d delimi|ter to c|
|00001680| 6f 6e 66 69 72 6d 20 74 | 68 61 74 20 74 68 65 20 |onfirm t|hat the |
|00001690| 73 74 72 69 6e 67 20 70 | 61 73 73 65 64 20 64 6f |string p|assed do|
|000016a0| 65 73 0d 09 09 09 69 6e | 64 65 65 64 20 63 6f 6e |es....in|deed con|
|000016b0| 74 61 69 6e 20 66 69 65 | 6c 64 20 69 6e 66 6f 72 |tain fie|ld infor|
|000016c0| 6d 61 74 69 6f 6e 20 2a | 2f 0d 09 09 66 69 65 6c |mation *|/...fiel|
|000016d0| 64 44 65 6c 69 6d 69 74 | 65 72 20 3d 20 53 74 72 |dDelimit|er = Str|
|000016e0| 69 6e 67 43 68 61 72 20 | 28 20 74 68 65 53 74 72 |ingChar |( theStr|
|000016f0| 69 6e 67 2c 20 6b 43 47 | 49 46 6f 72 6d 46 69 65 |ing, kCG|IFormFie|
|00001700| 6c 64 44 65 6c 69 6d 69 | 74 65 72 20 29 3b 0d 09 |ldDelimi|ter );..|
|00001710| 09 0d 09 09 69 66 20 28 | 20 66 69 65 6c 64 44 65 |....if (| fieldDe|
|00001720| 6c 69 6d 69 74 65 72 20 | 3d 3d 20 6e 69 6c 20 29 |limiter |== nil )|
|00001730| 0d 09 09 7b 0d 09 09 09 | 2f 2a 20 73 74 72 69 6e |...{....|/* strin|
|00001740| 67 20 64 6f 65 73 20 6e | 6f 74 20 63 6f 6e 74 61 |g does n|ot conta|
|00001750| 69 6e 20 66 69 65 6c 64 | 20 64 61 74 61 20 2a 2f |in field| data */|
|00001760| 0d 09 09 09 2a 6f 75 74 | 45 72 72 20 3d 20 31 3b |....*out|Err = 1;|
|00001770| 0d 09 09 09 0d 09 09 09 | 67 6f 74 6f 20 45 78 69 |........|goto Exi|
|00001780| 74 5f 46 61 69 6c 3b 0d | 09 09 7d 0d 09 7d 0d 09 |t_Fail;.|..}..}..|
|00001790| 0d 09 74 68 65 46 69 65 | 6c 64 73 20 3d 20 28 43 |..theFie|lds = (C|
|000017a0| 47 49 46 6f 72 6d 46 69 | 65 6c 64 20 2a 29 20 4d |GIFormFi|eld *) M|
|000017b0| 79 4e 65 77 50 74 72 20 | 28 20 28 28 74 6f 74 61 |yNewPtr |( ((tota|
|000017c0| 6c 46 69 65 6c 64 73 20 | 2b 20 31 29 20 2a 20 73 |lFields |+ 1) * s|
|000017d0| 69 7a 65 6f 66 28 43 47 | 49 46 6f 72 6d 46 69 65 |izeof(CG|IFormFie|
|000017e0| 6c 64 29 29 2c 20 6f 75 | 74 45 72 72 20 29 3b 0d |ld)), ou|tErr );.|
|000017f0| 09 0d 09 69 66 20 28 20 | 74 68 65 46 69 65 6c 64 |...if ( |theField|
|00001800| 73 20 3d 3d 20 6e 69 6c | 20 29 0d 09 7b 0d 09 09 |s == nil| )..{...|
|00001810| 2f 2a 20 6d 65 6d 6f 72 | 79 20 64 69 64 6e 27 74 |/* memor|y didn't|
|00001820| 20 61 6c 6c 6f 63 61 74 | 65 20 2a 2f 0d 09 09 2a | allocat|e */...*|
|00001830| 6f 75 74 45 72 72 20 3d | 20 6d 65 6d 46 75 6c 6c |outErr =| memFull|
|00001840| 45 72 72 3b 0d 09 09 0d | 09 09 67 6f 74 6f 20 45 |Err;....|..goto E|
|00001850| 78 69 74 5f 46 61 69 6c | 3b 0d 09 7d 0d 09 0d 09 |xit_Fail|;..}....|
|00001860| 2f 2a 20 73 65 74 20 74 | 68 65 20 6e 61 6d 65 20 |/* set t|he name |
|00001870| 61 6e 64 20 76 61 6c 75 | 65 20 6f 66 20 74 68 65 |and valu|e of the|
|00001880| 20 6c 61 73 74 20 66 69 | 65 6c 64 20 69 6e 20 74 | last fi|eld in t|
|00001890| 68 65 20 61 72 72 61 79 | 20 74 6f 20 6e 69 6c 20 |he array| to nil |
|000018a0| 2a 2f 0d 09 28 74 68 65 | 46 69 65 6c 64 73 5b 74 |*/..(the|Fields[t|
|000018b0| 6f 74 61 6c 46 69 65 6c | 64 73 5d 29 2e 6e 61 6d |otalFiel|ds]).nam|
|000018c0| 65 09 3d 20 6e 69 6c 3b | 0d 09 28 74 68 65 46 69 |e.= nil;|..(theFi|
|000018d0| 65 6c 64 73 5b 74 6f 74 | 61 6c 46 69 65 6c 64 73 |elds[tot|alFields|
|000018e0| 5d 29 2e 76 61 6c 75 65 | 09 3d 20 6e 69 6c 3b 0d |]).value|.= nil;.|
|000018f0| 09 0d 09 74 68 65 53 74 | 72 69 6e 67 50 74 72 20 |...theSt|ringPtr |
|00001900| 3d 20 74 68 65 53 74 72 | 69 6e 67 3b 0d 09 0d 09 |= theStr|ing;....|
|00001910| 66 6f 72 20 28 20 63 75 | 72 72 65 6e 74 46 69 65 |for ( cu|rrentFie|
|00001920| 6c 64 20 3d 20 6e 69 6c | 3b 20 63 75 72 72 65 6e |ld = nil|; curren|
|00001930| 74 46 69 65 6c 64 20 3c | 20 74 6f 74 61 6c 46 69 |tField <| totalFi|
|00001940| 65 6c 64 73 3b 20 63 75 | 72 72 65 6e 74 46 69 65 |elds; cu|rrentFie|
|00001950| 6c 64 2b 2b 20 29 0d 09 | 7b 0d 09 09 23 69 66 20 |ld++ )..|{...#if |
|00001960| 6b 43 6f 6d 70 69 6c 65 | 57 69 74 68 54 68 72 65 |kCompile|WithThre|
|00001970| 61 64 73 4f 70 74 69 6f | 6e 61 6c 0d 09 09 69 66 |adsOptio|nal...if|
|00001980| 20 28 20 67 48 61 73 54 | 68 72 65 61 64 4d 67 72 | ( gHasT|hreadMgr|
|00001990| 20 29 0d 09 09 23 65 6e | 64 69 66 0d 09 09 7b 0d | )...#en|dif...{.|
|000019a0| 09 09 09 59 69 65 6c 64 | 54 6f 41 6e 79 54 68 72 |...Yield|ToAnyThr|
|000019b0| 65 61 64 20 28 29 3b 0d | 09 09 7d 0d 09 09 0d 09 |ead ();.|..}.....|
|000019c0| 09 2f 2a 20 73 65 74 20 | 74 68 65 20 6e 61 6d 65 |./* set |the name|
|000019d0| 20 61 6e 64 20 76 61 6c | 75 65 20 6f 66 20 74 68 | and val|ue of th|
|000019e0| 65 20 63 75 72 72 65 6e | 74 20 66 69 65 6c 64 20 |e curren|t field |
|000019f0| 69 6e 20 74 68 65 20 61 | 72 72 61 79 20 74 6f 20 |in the a|rray to |
|00001a00| 6e 69 6c 2e 0d 09 09 09 | 74 68 69 73 20 69 73 20 |nil.....|this is |
|00001a10| 74 6f 20 68 61 6e 64 6c | 65 20 65 72 72 6f 72 73 |to handl|e errors|
|00001a20| 2e 20 2a 2f 0d 09 09 28 | 74 68 65 46 69 65 6c 64 |. */...(|theField|
|00001a30| 73 5b 63 75 72 72 65 6e | 74 46 69 65 6c 64 5d 29 |s[curren|tField])|
|00001a40| 2e 6e 61 6d 65 09 3d 20 | 6e 69 6c 3b 0d 09 09 28 |.name.= |nil;...(|
|00001a50| 74 68 65 46 69 65 6c 64 | 73 5b 63 75 72 72 65 6e |theField|s[curren|
|00001a60| 74 46 69 65 6c 64 5d 29 | 2e 76 61 6c 75 65 09 3d |tField])|.value.=|
|00001a70| 20 6e 69 6c 3b 0d 09 09 | 0d 09 09 66 69 65 6c 64 | nil;...|...field|
|00001a80| 44 65 6c 69 6d 69 74 65 | 72 09 3d 20 53 74 72 69 |Delimite|r.= Stri|
|00001a90| 6e 67 43 68 61 72 20 28 | 20 74 68 65 53 74 72 69 |ngChar (| theStri|
|00001aa0| 6e 67 50 74 72 2c 20 6b | 43 47 49 46 6f 72 6d 46 |ngPtr, k|CGIFormF|
|00001ab0| 69 65 6c 64 44 65 6c 69 | 6d 69 74 65 72 20 29 3b |ieldDeli|miter );|
|00001ac0| 0d 09 09 66 69 65 6c 64 | 53 65 70 61 72 61 74 6f |...field|Separato|
|00001ad0| 72 09 3d 20 53 74 72 69 | 6e 67 43 68 61 72 20 28 |r.= Stri|ngChar (|
|00001ae0| 20 74 68 65 53 74 72 69 | 6e 67 50 74 72 2c 20 6b | theStri|ngPtr, k|
|00001af0| 43 47 49 46 6f 72 6d 46 | 69 65 6c 64 53 65 70 61 |CGIFormF|ieldSepa|
|00001b00| 72 61 74 6f 72 20 29 3b | 0d 09 09 0d 09 09 2f 2a |rator );|....../*|
|00001b10| 20 69 66 20 74 68 65 72 | 65 20 69 73 20 61 20 66 | if ther|e is a f|
|00001b20| 69 65 6c 64 20 64 65 6c | 69 6d 69 74 65 72 2c 20 |ield del|imiter, |
|00001b30| 61 6e 64 20 69 74 20 69 | 73 20 62 65 66 6f 72 65 |and it i|s before|
|00001b40| 20 61 6e 79 20 66 69 65 | 6c 64 20 73 65 70 61 72 | any fie|ld separ|
|00001b50| 61 74 6f 72 20 2a 2f 0d | 09 09 69 66 20 28 20 28 |ator */.|..if ( (|
|00001b60| 66 69 65 6c 64 44 65 6c | 69 6d 69 74 65 72 20 21 |fieldDel|imiter !|
|00001b70| 3d 20 6e 69 6c 29 20 26 | 26 20 28 28 66 69 65 6c |= nil) &|& ((fiel|
|00001b80| 64 53 65 70 61 72 61 74 | 6f 72 20 3e 20 66 69 65 |dSeparat|or > fie|
|00001b90| 6c 64 44 65 6c 69 6d 69 | 74 65 72 29 20 7c 7c 20 |ldDelimi|ter) || |
|00001ba0| 28 66 69 65 6c 64 53 65 | 70 61 72 61 74 6f 72 20 |(fieldSe|parator |
|00001bb0| 3d 3d 20 6e 69 6c 29 29 | 20 29 0d 09 09 7b 0d 09 |== nil))| )...{..|
|00001bc0| 09 09 2f 2a 20 66 69 65 | 6c 64 20 6e 61 6d 65 20 |../* fie|ld name |
|00001bd0| 2a 2f 0d 09 09 09 2f 2a | 20 74 68 65 20 73 69 7a |*/..../*| the siz|
|00001be0| 65 20 6f 66 20 74 68 65 | 20 6e 61 6d 65 20 73 74 |e of the| name st|
|00001bf0| 72 69 6e 67 20 69 73 20 | 74 68 65 20 64 69 66 66 |ring is |the diff|
|00001c00| 65 72 65 6e 63 65 20 62 | 65 74 77 65 65 6e 20 74 |erence b|etween t|
|00001c10| 68 65 20 62 65 67 69 6e | 69 6e 67 20 6f 66 20 74 |he begin|ing of t|
|00001c20| 68 65 0d 09 09 09 09 66 | 69 65 6c 64 20 61 6e 64 |he.....f|ield and|
|00001c30| 20 74 68 65 20 70 6f 73 | 69 74 69 6f 6e 20 6f 66 | the pos|ition of|
|00001c40| 20 74 68 65 20 66 69 65 | 6c 64 20 64 65 6c 69 6d | the fie|ld delim|
|00001c50| 69 74 65 72 20 2a 2f 0d | 09 09 09 6e 61 6d 65 53 |iter */.|...nameS|
|00001c60| 69 7a 65 20 3d 20 66 69 | 65 6c 64 44 65 6c 69 6d |ize = fi|eldDelim|
|00001c70| 69 74 65 72 20 2d 20 74 | 68 65 53 74 72 69 6e 67 |iter - t|heString|
|00001c80| 50 74 72 3b 0d 09 09 09 | 0d 09 09 09 2f 2a 20 61 |Ptr;....|..../* a|
|00001c90| 6c 6c 6f 63 61 74 65 20 | 74 68 65 20 6e 61 6d 65 |llocate |the name|
|00001ca0| 20 73 74 72 69 6e 67 20 | 2a 2f 0d 09 09 09 28 74 | string |*/....(t|
|00001cb0| 68 65 46 69 65 6c 64 73 | 5b 63 75 72 72 65 6e 74 |heFields|[current|
|00001cc0| 46 69 65 6c 64 5d 29 2e | 6e 61 6d 65 20 3d 20 28 |Field]).|name = (|
|00001cd0| 63 68 61 72 20 2a 29 20 | 4d 79 4e 65 77 50 74 72 |char *) |MyNewPtr|
|00001ce0| 20 28 20 6e 61 6d 65 53 | 69 7a 65 20 2b 20 31 2c | ( nameS|ize + 1,|
|00001cf0| 20 6f 75 74 45 72 72 20 | 29 3b 0d 09 09 09 0d 09 | outErr |);......|
|00001d00| 09 09 69 66 20 28 20 28 | 74 68 65 46 69 65 6c 64 |..if ( (|theField|
|00001d10| 73 5b 63 75 72 72 65 6e | 74 46 69 65 6c 64 5d 29 |s[curren|tField])|
|00001d20| 2e 6e 61 6d 65 20 3d 3d | 20 6e 69 6c 20 29 0d 09 |.name ==| nil )..|
|00001d30| 09 09 7b 0d 09 09 09 09 | 2f 2a 20 6d 65 6d 6f 72 |..{.....|/* memor|
|00001d40| 79 20 64 69 64 6e 27 74 | 20 61 6c 6c 6f 63 61 74 |y didn't| allocat|
|00001d50| 65 20 2a 2f 0d 09 09 09 | 09 2a 6f 75 74 45 72 72 |e */....|.*outErr|
|00001d60| 20 3d 20 6d 65 6d 46 75 | 6c 6c 45 72 72 3b 0d 09 | = memFu|llErr;..|
|00001d70| 09 09 09 0d 09 09 09 09 | 28 74 68 65 46 69 65 6c |........|(theFiel|
|00001d80| 64 73 5b 63 75 72 72 65 | 6e 74 46 69 65 6c 64 5d |ds[curre|ntField]|
|00001d90| 29 2e 76 61 6c 75 65 20 | 3d 20 6e 69 6c 3b 0d 09 |).value |= nil;..|
|00001da0| 09 09 09 0d 09 09 09 09 | 67 6f 74 6f 20 45 78 69 |........|goto Exi|
|00001db0| 74 5f 46 61 69 6c 3b 0d | 09 09 09 7d 0d 09 09 09 |t_Fail;.|...}....|
|00001dc0| 0d 09 09 09 2f 2a 20 63 | 6f 70 79 20 74 68 65 20 |..../* c|opy the |
|00001dd0| 66 69 65 6c 64 20 6e 61 | 6d 65 20 2a 2f 0d 09 09 |field na|me */...|
|00001de0| 09 42 6c 6f 63 6b 4d 6f | 76 65 20 28 20 74 68 65 |.BlockMo|ve ( the|
|00001df0| 53 74 72 69 6e 67 50 74 | 72 2c 20 28 74 68 65 46 |StringPt|r, (theF|
|00001e00| 69 65 6c 64 73 5b 63 75 | 72 72 65 6e 74 46 69 65 |ields[cu|rrentFie|
|00001e10| 6c 64 5d 29 2e 6e 61 6d | 65 2c 20 6e 61 6d 65 53 |ld]).nam|e, nameS|
|00001e20| 69 7a 65 20 29 3b 0d 09 | 09 09 2f 2a 20 6e 75 6c |ize );..|../* nul|
|00001e30| 6c 20 74 65 72 6d 69 6e | 61 74 65 20 74 68 65 20 |l termin|ate the |
|00001e40| 65 6e 64 20 6f 66 20 74 | 68 65 20 6e 61 6d 65 20 |end of t|he name |
|00001e50| 73 74 72 69 6e 67 20 2a | 2f 0d 09 09 09 28 28 74 |string *|/....((t|
|00001e60| 68 65 46 69 65 6c 64 73 | 5b 63 75 72 72 65 6e 74 |heFields|[current|
|00001e70| 46 69 65 6c 64 5d 29 2e | 6e 61 6d 65 29 5b 6e 61 |Field]).|name)[na|
|00001e80| 6d 65 53 69 7a 65 5d 20 | 3d 20 6e 69 6c 3b 0d 09 |meSize] |= nil;..|
|00001e90| 09 09 2f 2a 20 63 6f 6e | 76 65 72 74 20 74 68 65 |../* con|vert the|
|00001ea0| 20 75 72 6c 20 65 6e 63 | 6f 64 65 64 20 74 65 78 | url enc|oded tex|
|00001eb0| 74 20 74 6f 20 61 20 6e | 6f 72 6d 61 6c 20 73 74 |t to a n|ormal st|
|00001ec0| 72 69 6e 67 20 2a 2f 0d | 09 09 09 43 47 49 44 65 |ring */.|...CGIDe|
|00001ed0| 63 6f 64 65 53 70 65 63 | 69 61 6c 43 68 61 72 73 |codeSpec|ialChars|
|00001ee0| 20 28 20 28 74 68 65 46 | 69 65 6c 64 73 5b 63 75 | ( (theF|ields[cu|
|00001ef0| 72 72 65 6e 74 46 69 65 | 6c 64 5d 29 2e 6e 61 6d |rrentFie|ld]).nam|
|00001f00| 65 20 29 3b 0d 09 09 09 | 0d 09 09 09 2f 2a 20 66 |e );....|..../* f|
|00001f10| 69 65 6c 64 20 76 61 6c | 75 65 20 2a 2f 0d 09 09 |ield val|ue */...|
|00001f20| 09 69 66 20 28 20 66 69 | 65 6c 64 53 65 70 61 72 |.if ( fi|eldSepar|
|00001f30| 61 74 6f 72 20 21 3d 20 | 6e 69 6c 20 29 0d 09 09 |ator != |nil )...|
|00001f40| 09 7b 0d 09 09 09 09 76 | 61 6c 75 65 53 69 7a 65 |.{.....v|alueSize|
|00001f50| 20 3d 20 66 69 65 6c 64 | 53 65 70 61 72 61 74 6f | = field|Separato|
|00001f60| 72 20 2d 20 28 66 69 65 | 6c 64 44 65 6c 69 6d 69 |r - (fie|ldDelimi|
|00001f70| 74 65 72 20 2b 20 31 29 | 3b 0d 09 09 09 7d 0d 09 |ter + 1)|;....}..|
|00001f80| 09 09 65 6c 73 65 0d 09 | 09 09 7b 0d 09 09 09 09 |..else..|..{.....|
|00001f90| 76 61 6c 75 65 53 69 7a | 65 20 3d 20 73 74 72 6c |valueSiz|e = strl|
|00001fa0| 65 6e 20 28 20 66 69 65 | 6c 64 44 65 6c 69 6d 69 |en ( fie|ldDelimi|
|00001fb0| 74 65 72 20 2b 20 31 20 | 29 3b 0d 09 09 09 7d 0d |ter + 1 |);....}.|
|00001fc0| 09 09 09 0d 09 09 09 28 | 74 68 65 46 69 65 6c 64 |.......(|theField|
|00001fd0| 73 5b 63 75 72 72 65 6e | 74 46 69 65 6c 64 5d 29 |s[curren|tField])|
|00001fe0| 2e 76 61 6c 75 65 20 3d | 20 28 63 68 61 72 20 2a |.value =| (char *|
|00001ff0| 29 20 4d 79 4e 65 77 50 | 74 72 20 28 20 28 76 61 |) MyNewP|tr ( (va|
|00002000| 6c 75 65 53 69 7a 65 20 | 2b 20 31 29 2c 20 6f 75 |lueSize |+ 1), ou|
|00002010| 74 45 72 72 20 29 3b 0d | 09 09 09 0d 09 09 09 69 |tErr );.|.......i|
|00002020| 66 20 28 20 28 74 68 65 | 46 69 65 6c 64 73 5b 63 |f ( (the|Fields[c|
|00002030| 75 72 72 65 6e 74 46 69 | 65 6c 64 5d 29 2e 76 61 |urrentFi|eld]).va|
|00002040| 6c 75 65 20 3d 3d 20 6e | 69 6c 20 29 0d 09 09 09 |lue == n|il )....|
|00002050| 7b 0d 09 09 09 09 2f 2a | 20 6d 65 6d 6f 72 79 20 |{...../*| memory |
|00002060| 64 69 64 6e 27 74 20 61 | 6c 6c 6f 63 61 74 65 20 |didn't a|llocate |
|00002070| 2a 2f 0d 09 09 09 09 2a | 6f 75 74 45 72 72 20 3d |*/.....*|outErr =|
|00002080| 20 6d 65 6d 46 75 6c 6c | 45 72 72 3b 0d 09 09 09 | memFull|Err;....|
|00002090| 09 0d 09 09 09 09 44 69 | 73 70 6f 73 65 50 74 72 |......Di|sposePtr|
|000020a0| 20 28 20 28 74 68 65 46 | 69 65 6c 64 73 5b 63 75 | ( (theF|ields[cu|
|000020b0| 72 72 65 6e 74 46 69 65 | 6c 64 5d 29 2e 6e 61 6d |rrentFie|ld]).nam|
|000020c0| 65 20 29 3b 0d 09 09 09 | 09 28 74 68 65 46 69 65 |e );....|.(theFie|
|000020d0| 6c 64 73 5b 63 75 72 72 | 65 6e 74 46 69 65 6c 64 |lds[curr|entField|
|000020e0| 5d 29 2e 6e 61 6d 65 20 | 3d 20 6e 69 6c 3b 0d 09 |]).name |= nil;..|
|000020f0| 09 09 09 0d 09 09 09 09 | 67 6f 74 6f 20 45 78 69 |........|goto Exi|
|00002100| 74 5f 46 61 69 6c 3b 0d | 09 09 09 7d 0d 09 09 09 |t_Fail;.|...}....|
|00002110| 0d 09 09 09 42 6c 6f 63 | 6b 4d 6f 76 65 20 28 20 |....Bloc|kMove ( |
|00002120| 66 69 65 6c 64 44 65 6c | 69 6d 69 74 65 72 20 2b |fieldDel|imiter +|
|00002130| 20 31 2c 20 28 74 68 65 | 46 69 65 6c 64 73 5b 63 | 1, (the|Fields[c|
|00002140| 75 72 72 65 6e 74 46 69 | 65 6c 64 5d 29 2e 76 61 |urrentFi|eld]).va|
|00002150| 6c 75 65 2c 20 76 61 6c | 75 65 53 69 7a 65 20 29 |lue, val|ueSize )|
|00002160| 3b 0d 09 09 09 28 28 74 | 68 65 46 69 65 6c 64 73 |;....((t|heFields|
|00002170| 5b 63 75 72 72 65 6e 74 | 46 69 65 6c 64 5d 29 2e |[current|Field]).|
|00002180| 76 61 6c 75 65 29 5b 76 | 61 6c 75 65 53 69 7a 65 |value)[v|alueSize|
|00002190| 5d 20 3d 20 6e 69 6c 3b | 0d 09 09 09 43 47 49 44 |] = nil;|....CGID|
|000021a0| 65 63 6f 64 65 53 70 65 | 63 69 61 6c 43 68 61 72 |ecodeSpe|cialChar|
|000021b0| 73 20 28 20 28 74 68 65 | 46 69 65 6c 64 73 5b 63 |s ( (the|Fields[c|
|000021c0| 75 72 72 65 6e 74 46 69 | 65 6c 64 5d 29 2e 76 61 |urrentFi|eld]).va|
|000021d0| 6c 75 65 20 29 3b 0d 09 | 09 09 0d 09 09 09 74 68 |lue );..|......th|
|000021e0| 65 53 74 72 69 6e 67 50 | 74 72 20 3d 20 66 69 65 |eStringP|tr = fie|
|000021f0| 6c 64 53 65 70 61 72 61 | 74 6f 72 20 2b 20 31 3b |ldSepara|tor + 1;|
|00002200| 0d 09 09 7d 0d 09 09 65 | 6c 73 65 0d 09 09 7b 0d |...}...e|lse...{.|
|00002210| 09 09 09 2f 2a 20 69 6e | 76 61 6c 69 64 20 64 61 |.../* in|valid da|
|00002220| 74 61 20 65 6e 63 6f 75 | 6e 74 65 72 65 64 20 2a |ta encou|ntered *|
|00002230| 2f 0d 09 09 09 2a 6f 75 | 74 45 72 72 20 3d 20 32 |/....*ou|tErr = 2|
|00002240| 3b 0d 09 09 09 0d 09 09 | 09 67 6f 74 6f 20 45 78 |;.......|.goto Ex|
|00002250| 69 74 5f 46 61 69 6c 3b | 0d 09 09 7d 0d 09 7d 0d |it_Fail;|...}..}.|
|00002260| 09 0d 09 2f 2a 20 61 73 | 73 69 67 6e 20 74 68 65 |.../* as|sign the|
|00002270| 20 72 65 74 75 72 6e 20 | 70 61 72 61 6d 65 74 65 | return |paramete|
|00002280| 72 73 20 76 61 6c 75 65 | 73 20 2a 2f 0d 09 2a 63 |rs value|s */..*c|
|00002290| 6f 75 6e 74 09 3d 20 74 | 6f 74 61 6c 46 69 65 6c |ount.= t|otalFiel|
|000022a0| 64 73 3b 0d 09 2a 6f 75 | 74 45 72 72 09 3d 20 6e |ds;..*ou|tErr.= n|
|000022b0| 6f 45 72 72 3b 0d 09 0d | 09 72 65 74 75 72 6e 20 |oErr;...|.return |
|000022c0| 74 68 65 46 69 65 6c 64 | 73 3b 0d 09 0d 09 0d 09 |theField|s;......|
|000022d0| 45 78 69 74 5f 46 61 69 | 6c 3a 0d 09 0d 09 69 66 |Exit_Fai|l:....if|
|000022e0| 20 28 20 74 68 65 46 69 | 65 6c 64 73 20 21 3d 20 | ( theFi|elds != |
|000022f0| 6e 69 6c 20 29 0d 09 7b | 0d 09 09 2f 2a 20 72 65 |nil )..{|.../* re|
|00002300| 6c 65 61 73 65 20 61 6c | 6c 6f 63 61 74 65 64 20 |lease al|located |
|00002310| 6d 65 6d 6f 72 79 20 2a | 2f 0d 09 09 43 47 49 46 |memory *|/...CGIF|
|00002320| 6f 72 6d 46 69 65 6c 64 | 73 44 69 73 70 6f 73 65 |ormField|sDispose|
|00002330| 20 28 20 74 68 65 46 69 | 65 6c 64 73 20 29 3b 0d | ( theFi|elds );.|
|00002340| 09 7d 0d 09 0d 09 72 65 | 74 75 72 6e 20 6e 69 6c |.}....re|turn nil|
|00002350| 3b 0d 7d 20 2f 2a 20 43 | 47 49 46 6f 72 6d 46 69 |;.} /* C|GIFormFi|
|00002360| 65 6c 64 73 46 72 6f 6d | 41 72 67 73 20 2a 2f 0d |eldsFrom|Args */.|
|00002370| 0d 0d 2f 2a 20 52 65 74 | 75 72 6e 73 20 61 20 70 |../* Ret|urns a p|
|00002380| 6f 69 6e 74 65 72 20 74 | 6f 20 74 68 65 20 66 69 |ointer t|o the fi|
|00002390| 72 73 74 20 66 6f 72 6d | 20 66 69 65 6c 64 20 72 |rst form| field r|
|000023a0| 65 63 6f 72 64 2c 20 69 | 6e 20 74 68 65 20 67 69 |ecord, i|n the gi|
|000023b0| 76 65 6e 20 66 69 65 6c | 64 41 72 72 61 79 2c 0d |ven fiel|dArray,.|
|000023c0| 09 74 68 61 74 27 73 20 | 6e 61 6d 65 20 6d 61 74 |.that's |name mat|
|000023d0| 63 68 65 73 20 74 68 65 | 20 73 75 70 70 6c 69 65 |ches the| supplie|
|000023e0| 64 20 66 69 65 6c 64 20 | 6e 61 6d 65 2e 0d 09 5b |d field |name...[|
|000023f0| 6d 6f 64 69 66 69 65 64 | 20 66 6f 72 20 31 2e 30 |modified| for 1.0|
|00002400| 62 34 20 2d 20 75 73 65 | 20 43 47 49 48 64 6c 20 |b4 - use| CGIHdl |
|00002410| 61 73 20 70 61 72 61 6d | 65 74 65 72 20 69 6e 73 |as param|eter ins|
|00002420| 74 65 61 64 20 6f 66 20 | 43 47 49 46 6f 72 6d 46 |tead of |CGIFormF|
|00002430| 69 65 6c 64 5d 20 2a 2f | 0d 43 47 49 46 6f 72 6d |ield] */|.CGIForm|
|00002440| 46 69 65 6c 64 20 2a 0d | 43 47 49 46 6f 72 6d 46 |Field *.|CGIFormF|
|00002450| 69 65 6c 64 73 46 69 6e | 64 52 65 63 6f 72 64 20 |ieldsFin|dRecord |
|00002460| 28 20 43 47 49 48 64 6c | 20 74 68 65 43 47 49 48 |( CGIHdl| theCGIH|
|00002470| 64 6c 2c 20 63 68 61 72 | 20 2a 66 69 65 6c 64 4e |dl, char| *fieldN|
|00002480| 61 6d 65 20 29 0d 7b 0d | 09 43 47 49 46 6f 72 6d |ame ).{.|.CGIForm|
|00002490| 46 69 65 6c 64 09 2a 66 | 69 65 6c 64 41 72 72 61 |Field.*f|ieldArra|
|000024a0| 79 3b 0d 09 6c 6f 6e 67 | 09 09 09 63 75 72 72 65 |y;..long|...curre|
|000024b0| 6e 74 46 69 65 6c 64 3b | 0d 09 0d 09 6d 79 5f 61 |ntField;|....my_a|
|000024c0| 73 73 65 72 74 20 28 20 | 74 68 65 43 47 49 48 64 |ssert ( |theCGIHd|
|000024d0| 6c 20 21 3d 20 6e 69 6c | 2c 20 22 5c 70 43 47 49 |l != nil|, "\pCGI|
|000024e0| 46 6f 72 6d 46 69 65 6c | 64 73 46 69 6e 64 52 65 |FormFiel|dsFindRe|
|000024f0| 63 6f 72 64 3a 20 74 68 | 65 43 47 49 48 64 6c 20 |cord: th|eCGIHdl |
|00002500| 69 73 20 6e 69 6c 22 20 | 29 3b 0d 09 6d 79 5f 61 |is nil" |);..my_a|
|00002510| 73 73 65 72 74 20 28 20 | 66 69 65 6c 64 4e 61 6d |ssert ( |fieldNam|
|00002520| 65 20 21 3d 20 6e 69 6c | 2c 20 22 5c 70 43 47 49 |e != nil|, "\pCGI|
|00002530| 46 6f 72 6d 46 69 65 6c | 64 73 46 69 6e 64 52 65 |FormFiel|dsFindRe|
|00002540| 63 6f 72 64 3a 20 66 69 | 65 6c 64 4e 61 6d 65 20 |cord: fi|eldName |
|00002550| 69 73 20 6e 69 6c 22 20 | 29 3b 0d 09 0d 09 66 69 |is nil" |);....fi|
|00002560| 65 6c 64 41 72 72 61 79 | 20 3d 20 28 2a 74 68 65 |eldArray| = (*the|
|00002570| 43 47 49 48 64 6c 29 2d | 3e 66 6f 72 6d 46 69 65 |CGIHdl)-|>formFie|
|00002580| 6c 64 73 3b 0d 09 0d 09 | 69 66 20 28 20 28 2a 74 |lds;....|if ( (*t|
|00002590| 68 65 43 47 49 48 64 6c | 29 2d 3e 66 6f 72 6d 46 |heCGIHdl|)->formF|
|000025a0| 69 65 6c 64 73 20 3d 3d | 20 6e 69 6c 20 29 0d 09 |ields ==| nil )..|
|000025b0| 7b 0d 09 09 72 65 74 75 | 72 6e 20 6e 69 6c 3b 0d |{...retu|rn nil;.|
|000025c0| 09 7d 0d 09 0d 09 2f 2a | 20 6c 6f 6f 6b 20 74 69 |.}..../*| look ti|
|000025d0| 6c 20 77 65 20 66 69 6e | 64 20 73 6f 6d 65 74 68 |l we fin|d someth|
|000025e0| 69 6e 67 20 6f 72 20 77 | 65 20 68 69 74 20 74 68 |ing or w|e hit th|
|000025f0| 65 20 65 6e 64 20 2a 2f | 0d 09 66 6f 72 20 28 20 |e end */|..for ( |
|00002600| 63 75 72 72 65 6e 74 46 | 69 65 6c 64 20 3d 20 6e |currentF|ield = n|
|00002610| 69 6c 3b 20 28 66 69 65 | 6c 64 41 72 72 61 79 5b |il; (fie|ldArray[|
|00002620| 63 75 72 72 65 6e 74 46 | 69 65 6c 64 5d 29 2e 6e |currentF|ield]).n|
|00002630| 61 6d 65 20 21 3d 20 6e | 69 6c 3b 20 63 75 72 72 |ame != n|il; curr|
|00002640| 65 6e 74 46 69 65 6c 64 | 2b 2b 20 29 0d 09 7b 0d |entField|++ )..{.|
|00002650| 09 09 23 69 66 20 6b 43 | 6f 6d 70 69 6c 65 57 69 |..#if kC|ompileWi|
|00002660| 74 68 54 68 72 65 61 64 | 73 4f 70 74 69 6f 6e 61 |thThread|sOptiona|
|00002670| 6c 0d 09 09 69 66 20 28 | 20 67 48 61 73 54 68 72 |l...if (| gHasThr|
|00002680| 65 61 64 4d 67 72 20 29 | 0d 09 09 23 65 6e 64 69 |eadMgr )|...#endi|
|00002690| 66 0d 09 09 7b 0d 09 09 | 09 59 69 65 6c 64 54 6f |f...{...|.YieldTo|
|000026a0| 41 6e 79 54 68 72 65 61 | 64 20 28 29 3b 0d 09 09 |AnyThrea|d ();...|
|000026b0| 7d 0d 09 09 0d 09 09 69 | 66 20 28 20 73 74 72 63 |}......i|f ( strc|
|000026c0| 6d 70 28 28 66 69 65 6c | 64 41 72 72 61 79 5b 63 |mp((fiel|dArray[c|
|000026d0| 75 72 72 65 6e 74 46 69 | 65 6c 64 5d 29 2e 6e 61 |urrentFi|eld]).na|
|000026e0| 6d 65 2c 20 66 69 65 6c | 64 4e 61 6d 65 29 20 3d |me, fiel|dName) =|
|000026f0| 3d 20 6e 69 6c 20 29 0d | 09 09 7b 0d 09 09 09 2f |= nil ).|..{..../|
|00002700| 2a 20 66 6f 75 6e 64 20 | 61 20 6d 61 74 63 68 2c |* found |a match,|
|00002710| 20 73 6f 20 77 65 27 72 | 65 20 64 6f 6e 65 20 2a | so we'r|e done *|
|00002720| 2f 0d 09 09 09 72 65 74 | 75 72 6e 20 26 28 66 69 |/....ret|urn &(fi|
|00002730| 65 6c 64 41 72 72 61 79 | 5b 63 75 72 72 65 6e 74 |eldArray|[current|
|00002740| 46 69 65 6c 64 5d 29 3b | 0d 09 09 7d 0d 09 7d 0d |Field]);|...}..}.|
|00002750| 09 0d 09 2f 2a 20 64 69 | 64 6e 27 74 20 66 69 6e |.../* di|dn't fin|
|00002760| 64 20 61 20 6d 61 74 63 | 68 20 2a 2f 0d 09 72 65 |d a matc|h */..re|
|00002770| 74 75 72 6e 20 6e 69 6c | 3b 0d 7d 20 2f 2a 20 43 |turn nil|;.} /* C|
|00002780| 47 49 46 6f 72 6d 46 69 | 65 6c 64 73 46 69 6e 64 |GIFormFi|eldsFind|
|00002790| 52 65 63 6f 72 64 20 2a | 2f 0d 0d 0d 2f 2a 20 52 |Record *|/.../* R|
|000027a0| 65 74 75 72 6e 73 20 61 | 20 70 6f 69 6e 74 65 72 |eturns a| pointer|
|000027b0| 20 74 6f 20 74 68 65 20 | 73 74 72 69 6e 67 20 63 | to the |string c|
|000027c0| 6f 6e 74 61 69 6e 69 6e | 67 20 74 68 65 20 76 61 |ontainin|g the va|
|000027d0| 6c 75 65 20 66 72 6f 6d | 20 74 68 65 20 66 69 65 |lue from| the fie|
|000027e0| 6c 64 20 73 70 65 63 69 | 66 69 65 64 0d 09 62 79 |ld speci|fied..by|
|000027f0| 20 27 66 69 65 6c 64 4e | 61 6d 65 27 2e 20 52 65 | 'fieldN|ame'. Re|
|00002800| 74 75 72 6e 73 20 61 20 | 70 6f 69 6e 74 65 72 20 |turns a |pointer |
|00002810| 74 6f 20 61 20 6e 75 6c | 6c 20 73 74 72 69 6e 67 |to a nul|l string|
|00002820| 20 28 22 22 29 20 69 66 | 20 74 68 65 20 66 69 65 | ("") if| the fie|
|00002830| 6c 64 20 69 73 20 6e 6f | 74 0d 09 66 6f 75 6e 64 |ld is no|t..found|
|00002840| 2e 0d 09 49 4d 50 4f 52 | 54 41 4e 54 3a 20 57 68 |...IMPOR|TANT: Wh|
|00002850| 61 74 65 76 65 72 20 79 | 6f 75 20 64 6f 20 2d 20 |atever y|ou do - |
|00002860| 64 6f 20 6e 6f 74 20 61 | 74 74 65 6d 70 74 20 74 |do not a|ttempt t|
|00002870| 6f 20 64 65 61 6c 6c 6f | 63 61 74 65 20 74 68 65 |o deallo|cate the|
|00002880| 20 73 74 72 69 6e 67 20 | 72 65 74 75 72 6e 65 64 | string |returned|
|00002890| 0d 09 62 79 20 74 68 69 | 73 20 66 75 6e 63 74 69 |..by thi|s functi|
|000028a0| 6f 6e 21 21 21 20 2a 2f | 0d 63 68 61 72 20 2a 0d |on!!! */|.char *.|
|000028b0| 43 47 49 46 6f 72 6d 46 | 69 65 6c 64 73 46 69 6e |CGIFormF|ieldsFin|
|000028c0| 64 56 61 6c 75 65 20 28 | 20 43 47 49 48 64 6c 20 |dValue (| CGIHdl |
|000028d0| 74 68 65 43 47 49 48 64 | 6c 2c 20 63 68 61 72 20 |theCGIHd|l, char |
|000028e0| 2a 66 69 65 6c 64 4e 61 | 6d 65 20 29 0d 7b 0d 09 |*fieldNa|me ).{..|
|000028f0| 43 47 49 46 6f 72 6d 46 | 69 65 6c 64 20 2a 09 74 |CGIFormF|ield *.t|
|00002900| 68 65 46 69 65 6c 64 3b | 0d 09 0d 09 6d 79 5f 61 |heField;|....my_a|
|00002910| 73 73 65 72 74 20 28 20 | 74 68 65 43 47 49 48 64 |ssert ( |theCGIHd|
|00002920| 6c 20 21 3d 20 6e 69 6c | 2c 20 22 5c 70 43 47 49 |l != nil|, "\pCGI|
|00002930| 46 6f 72 6d 46 69 65 6c | 64 73 46 69 6e 64 56 61 |FormFiel|dsFindVa|
|00002940| 6c 75 65 3a 20 74 68 65 | 43 47 49 48 64 6c 20 69 |lue: the|CGIHdl i|
|00002950| 73 20 6e 69 6c 22 20 29 | 3b 0d 09 6d 79 5f 61 73 |s nil" )|;..my_as|
|00002960| 73 65 72 74 20 28 20 66 | 69 65 6c 64 4e 61 6d 65 |sert ( f|ieldName|
|00002970| 20 21 3d 20 6e 69 6c 2c | 20 22 5c 70 43 47 49 46 | != nil,| "\pCGIF|
|00002980| 6f 72 6d 46 69 65 6c 64 | 73 46 69 6e 64 56 61 6c |ormField|sFindVal|
|00002990| 75 65 3a 20 66 69 65 6c | 64 4e 61 6d 65 20 69 73 |ue: fiel|dName is|
|000029a0| 20 6e 69 6c 22 20 29 3b | 0d 09 0d 09 74 68 65 46 | nil" );|....theF|
|000029b0| 69 65 6c 64 20 3d 20 43 | 47 49 46 6f 72 6d 46 69 |ield = C|GIFormFi|
|000029c0| 65 6c 64 73 46 69 6e 64 | 52 65 63 6f 72 64 20 28 |eldsFind|Record (|
|000029d0| 20 74 68 65 43 47 49 48 | 64 6c 2c 20 66 69 65 6c | theCGIH|dl, fiel|
|000029e0| 64 4e 61 6d 65 20 29 3b | 0d 09 69 66 20 28 20 28 |dName );|..if ( (|
|000029f0| 74 68 65 46 69 65 6c 64 | 20 3d 3d 20 6e 69 6c 29 |theField| == nil)|
|00002a00| 20 7c 7c 20 28 74 68 65 | 46 69 65 6c 64 2d 3e 76 | || (the|Field->v|
|00002a10| 61 6c 75 65 20 3d 3d 20 | 6e 69 6c 29 20 29 0d 09 |alue == |nil) )..|
|00002a20| 7b 0d 09 09 72 65 74 75 | 72 6e 20 76 4e 55 4c 4c |{...retu|rn vNULL|
|00002a30| 53 74 72 69 6e 67 3b 0d | 09 7d 0d 09 65 6c 73 65 |String;.|.}..else|
|00002a40| 0d 09 7b 0d 09 0d 09 09 | 72 65 74 75 72 6e 20 74 |..{.....|return t|
|00002a50| 68 65 46 69 65 6c 64 2d | 3e 76 61 6c 75 65 3b 0d |heField-|>value;.|
|00002a60| 09 7d 0d 7d 20 2f 2a 20 | 43 47 49 46 6f 72 6d 46 |.}.} /* |CGIFormF|
|00002a70| 69 65 6c 64 73 46 69 6e | 64 56 61 6c 75 65 20 2a |ieldsFin|dValue *|
|00002a80| 2f 0d 0d 0d 2f 2a 20 44 | 65 61 6c 6c 6f 63 61 74 |/.../* D|eallocat|
|00002a90| 65 20 6d 65 6d 6f 72 79 | 20 66 6f 72 20 74 68 65 |e memory| for the|
|00002aa0| 46 69 65 6c 64 73 20 61 | 72 72 61 79 2e 0d 09 59 |Fields a|rray...Y|
|00002ab0| 6f 75 20 67 65 6e 65 72 | 61 6c 6c 79 20 73 68 6f |ou gener|ally sho|
|00002ac0| 75 6c 64 6e 27 74 20 63 | 61 6c 6c 20 74 68 69 73 |uldn't c|all this|
|00002ad0| 20 66 75 6e 63 74 69 6f | 6e 20 6f 75 74 73 69 64 | functio|n outsid|
|00002ae0| 65 20 74 68 69 73 20 66 | 69 6c 65 2e 0d 09 55 73 |e this f|ile...Us|
|00002af0| 65 20 69 74 20 61 74 20 | 79 6f 75 72 20 6f 77 6e |e it at |your own|
|00002b00| 20 72 69 73 6b 2e 20 2a | 2f 0d 76 6f 69 64 0d 43 | risk. *|/.void.C|
|00002b10| 47 49 46 6f 72 6d 46 69 | 65 6c 64 73 44 69 73 70 |GIFormFi|eldsDisp|
|00002b20| 6f 73 65 20 28 20 43 47 | 49 46 6f 72 6d 46 69 65 |ose ( CG|IFormFie|
|00002b30| 6c 64 20 2a 74 68 65 46 | 69 65 6c 64 73 20 29 0d |ld *theF|ields ).|
|00002b40| 7b 0d 09 6c 6f 6e 67 09 | 6f 66 66 73 65 74 3b 0d |{..long.|offset;.|
|00002b50| 09 0d 09 6d 79 5f 61 73 | 73 65 72 74 20 28 20 74 |...my_as|sert ( t|
|00002b60| 68 65 46 69 65 6c 64 73 | 20 21 3d 20 6e 69 6c 2c |heFields| != nil,|
|00002b70| 20 22 5c 70 43 47 49 46 | 6f 72 6d 46 69 65 6c 64 | "\pCGIF|ormField|
|00002b80| 73 44 69 73 70 6f 73 65 | 3a 20 6e 75 6c 6c 20 66 |sDispose|: null f|
|00002b90| 69 65 6c 64 20 61 72 72 | 61 79 20 70 6f 69 6e 74 |ield arr|ay point|
|00002ba0| 65 72 22 20 29 3b 0d 09 | 0d 09 6f 66 66 73 65 74 |er" );..|..offset|
|00002bb0| 20 3d 20 6e 69 6c 3b 0d | 09 0d 09 64 6f 0d 09 7b | = nil;.|...do..{|
|00002bc0| 0d 09 09 23 69 66 20 6b | 43 6f 6d 70 69 6c 65 57 |...#if k|CompileW|
|00002bd0| 69 74 68 54 68 72 65 61 | 64 73 4f 70 74 69 6f 6e |ithThrea|dsOption|
|00002be0| 61 6c 0d 09 09 69 66 20 | 28 20 67 48 61 73 54 68 |al...if |( gHasTh|
|00002bf0| 72 65 61 64 4d 67 72 20 | 29 0d 09 09 23 65 6e 64 |readMgr |)...#end|
|00002c00| 69 66 0d 09 09 7b 0d 09 | 09 09 59 69 65 6c 64 54 |if...{..|..YieldT|
|00002c10| 6f 41 6e 79 54 68 72 65 | 61 64 20 28 29 3b 0d 09 |oAnyThre|ad ();..|
|00002c20| 09 7d 0d 09 09 0d 09 09 | 69 66 20 28 20 28 74 68 |.}......|if ( (th|
|00002c30| 65 46 69 65 6c 64 73 5b | 6f 66 66 73 65 74 5d 29 |eFields[|offset])|
|00002c40| 2e 6e 61 6d 65 20 21 3d | 20 6e 69 6c 20 29 0d 09 |.name !=| nil )..|
|00002c50| 09 7b 0d 09 09 09 2f 2a | 20 69 66 20 74 68 65 72 |.{..../*| if ther|
|00002c60| 65 27 73 20 61 20 6e 61 | 6d 65 20 73 74 72 69 6e |e's a na|me strin|
|00002c70| 67 2c 20 64 65 61 6c 6c | 6f 63 61 74 65 20 69 74 |g, deall|ocate it|
|00002c80| 73 20 6d 65 6d 6f 72 79 | 20 2a 2f 0d 09 09 09 44 |s memory| */....D|
|00002c90| 69 73 70 6f 73 65 50 74 | 72 20 28 20 28 50 74 72 |isposePt|r ( (Ptr|
|00002ca0| 29 28 28 74 68 65 46 69 | 65 6c 64 73 5b 6f 66 66 |)((theFi|elds[off|
|00002cb0| 73 65 74 5d 29 2e 6e 61 | 6d 65 29 20 29 3b 0d 09 |set]).na|me) );..|
|00002cc0| 09 09 0d 09 09 09 69 66 | 20 28 20 28 74 68 65 46 |......if| ( (theF|
|00002cd0| 69 65 6c 64 73 5b 6f 66 | 66 73 65 74 5d 29 2e 76 |ields[of|fset]).v|
|00002ce0| 61 6c 75 65 20 21 3d 20 | 6e 69 6c 20 29 0d 09 09 |alue != |nil )...|
|00002cf0| 09 7b 0d 09 09 09 09 2f | 2a 20 69 66 20 74 68 65 |.{...../|* if the|
|00002d00| 72 65 27 73 20 61 20 76 | 61 6c 75 65 20 73 74 72 |re's a v|alue str|
|00002d10| 69 6e 67 2c 20 64 65 61 | 6c 6c 6f 63 61 74 65 20 |ing, dea|llocate |
|00002d20| 69 74 73 20 6d 65 6d 6f | 72 79 20 2a 2f 0d 09 09 |its memo|ry */...|
|00002d30| 09 09 44 69 73 70 6f 73 | 65 50 74 72 20 28 20 28 |..Dispos|ePtr ( (|
|00002d40| 50 74 72 29 28 28 74 68 | 65 46 69 65 6c 64 73 5b |Ptr)((th|eFields[|
|00002d50| 6f 66 66 73 65 74 5d 29 | 2e 76 61 6c 75 65 29 20 |offset])|.value) |
|00002d60| 29 3b 0d 09 09 09 7d 0d | 09 09 7d 0d 09 09 0d 09 |);....}.|..}.....|
|00002d70| 09 6f 66 66 73 65 74 2b | 2b 3b 0d 09 7d 20 77 68 |.offset+|+;..} wh|
|00002d80| 69 6c 65 20 28 20 28 74 | 68 65 46 69 65 6c 64 73 |ile ( (t|heFields|
|00002d90| 5b 6f 66 66 73 65 74 5d | 29 2e 6e 61 6d 65 20 21 |[offset]|).name !|
|00002da0| 3d 20 6e 69 6c 20 29 3b | 0d 09 0d 09 44 69 73 70 |= nil );|....Disp|
|00002db0| 6f 73 65 50 74 72 20 28 | 20 28 50 74 72 29 74 68 |osePtr (| (Ptr)th|
|00002dc0| 65 46 69 65 6c 64 73 20 | 29 3b 0d 7d 20 2f 2a 20 |eFields |);.} /* |
|00002dd0| 43 47 49 46 6f 72 6d 46 | 69 65 6c 64 73 44 69 73 |CGIFormF|ieldsDis|
|00002de0| 70 6f 73 65 20 2a 2f 0d | 0d 23 65 6e 64 69 66 09 |pose */.|.#endif.|
|00002df0| 2f 2a 20 6b 43 6f 6d 70 | 69 6c 65 57 69 74 68 43 |/* kComp|ileWithC|
|00002e00| 47 49 46 6f 72 6d 48 61 | 6e 64 6c 69 6e 67 20 2a |GIFormHa|ndling *|
|00002e10| 2f 0d 0d 0d 2f 2a 2a 20 | 20 41 43 54 49 4f 4e 20 |/.../** | ACTION |
|00002e20| 53 55 50 50 4f 52 54 20 | 20 2a 2a 2f 0d 23 70 72 |SUPPORT | **/.#pr|
|00002e30| 61 67 6d 61 20 6d 61 72 | 6b 20 2d 0d 23 69 66 20 |agma mar|k -.#if |
|00002e40| 6b 43 6f 6d 70 69 6c 65 | 57 69 74 68 43 47 49 41 |kCompile|WithCGIA|
|00002e50| 63 74 69 6f 6e 53 75 70 | 70 6f 72 74 0d 0d 2f 2a |ctionSup|port../*|
|00002e60| 20 52 65 74 75 72 6e 73 | 20 74 72 75 65 20 69 66 | Returns| true if|
|00002e70| 20 74 68 65 20 61 63 74 | 69 6f 6e 20 70 61 72 61 | the act|ion para|
|00002e80| 6d 65 74 65 72 20 69 73 | 20 65 69 74 68 65 72 20 |meter is| either |
|00002e90| 43 47 49 20 6f 72 20 41 | 43 47 49 2e 20 2a 2f 0d |CGI or A|CGI. */.|
|00002ea0| 42 6f 6f 6c 65 61 6e 0d | 43 47 49 41 63 74 69 6f |Boolean.|CGIActio|
|00002eb0| 6e 49 73 43 47 49 6f 72 | 41 43 47 49 20 28 20 43 |nIsCGIor|ACGI ( C|
|00002ec0| 47 49 48 64 6c 20 74 68 | 65 43 47 49 48 64 6c 20 |GIHdl th|eCGIHdl |
|00002ed0| 29 0d 7b 0d 09 69 6e 74 | 09 09 73 74 72 69 6e 67 |).{..int|..string|
|00002ee0| 44 69 66 66 65 72 65 6e | 63 65 3b 0d 09 0d 09 6d |Differen|ce;....m|
|00002ef0| 79 5f 61 73 73 65 72 74 | 20 28 20 74 68 65 43 47 |y_assert| ( theCG|
|00002f00| 49 48 64 6c 20 21 3d 20 | 6e 69 6c 2c 20 22 5c 70 |IHdl != |nil, "\p|
|00002f10| 43 47 49 41 63 74 69 6f | 6e 49 73 43 47 49 6f 72 |CGIActio|nIsCGIor|
|00002f20| 41 43 47 49 3a 20 74 68 | 65 43 47 49 48 64 6c 20 |ACGI: th|eCGIHdl |
|00002f30| 69 73 20 6e 69 6c 22 20 | 29 3b 0d 09 0d 09 2f 2a |is nil" |);..../*|
|00002f40| 20 69 73 20 74 68 65 20 | 61 63 74 69 6f 6e 20 22 | is the |action "|
|00002f50| 43 47 49 22 3f 20 2a 2f | 0d 09 73 74 72 69 6e 67 |CGI"? */|..string|
|00002f60| 44 69 66 66 65 72 65 6e | 63 65 20 3d 20 73 74 72 |Differen|ce = str|
|00002f70| 63 6d 70 20 28 20 28 2a | 74 68 65 43 47 49 48 64 |cmp ( (*|theCGIHd|
|00002f80| 6c 29 2d 3e 61 63 74 69 | 6f 6e 2c 20 6b 43 47 49 |l)->acti|on, kCGI|
|00002f90| 41 63 74 69 6f 6e 4e 61 | 6d 65 43 47 49 20 29 3b |ActionNa|meCGI );|
|00002fa0| 0d 09 69 66 20 28 20 73 | 74 72 69 6e 67 44 69 66 |..if ( s|tringDif|
|00002fb0| 66 65 72 65 6e 63 65 20 | 3d 3d 20 6e 69 6c 20 29 |ference |== nil )|
|00002fc0| 0d 09 7b 0d 09 09 72 65 | 74 75 72 6e 20 74 72 75 |..{...re|turn tru|
|00002fd0| 65 3b 0d 09 7d 0d 09 0d | 09 2f 2a 20 69 73 20 74 |e;..}...|./* is t|
|00002fe0| 68 65 20 61 63 74 69 6f | 6e 20 22 41 43 47 49 22 |he actio|n "ACGI"|
|00002ff0| 3f 20 2a 2f 0d 09 73 74 | 72 69 6e 67 44 69 66 66 |? */..st|ringDiff|
|00003000| 65 72 65 6e 63 65 20 3d | 20 73 74 72 63 6d 70 20 |erence =| strcmp |
|00003010| 28 20 28 2a 74 68 65 43 | 47 49 48 64 6c 29 2d 3e |( (*theC|GIHdl)->|
|00003020| 61 63 74 69 6f 6e 2c 20 | 6b 43 47 49 41 63 74 69 |action, |kCGIActi|
|00003030| 6f 6e 4e 61 6d 65 41 43 | 47 49 20 29 3b 0d 09 69 |onNameAC|GI );..i|
|00003040| 66 20 28 20 73 74 72 69 | 6e 67 44 69 66 66 65 72 |f ( stri|ngDiffer|
|00003050| 65 6e 63 65 20 3d 3d 20 | 6e 69 6c 20 29 0d 09 7b |ence == |nil )..{|
|00003060| 0d 09 09 72 65 74 75 72 | 6e 20 74 72 75 65 3b 0d |...retur|n true;.|
|00003070| 09 7d 0d 09 0d 09 2f 2a | 20 64 69 64 6e 27 74 20 |.}..../*| didn't |
|00003080| 66 69 6e 64 20 61 20 6d | 61 74 63 68 20 2a 2f 0d |find a m|atch */.|
|00003090| 09 72 65 74 75 72 6e 20 | 66 61 6c 73 65 3b 0d 7d |.return |false;.}|
|000030a0| 20 2f 2a 20 43 47 49 41 | 63 74 69 6f 6e 49 73 43 | /* CGIA|ctionIsC|
|000030b0| 47 49 6f 72 41 43 47 49 | 20 2a 2f 0d 0d 23 65 6e |GIorACGI| */..#en|
|000030c0| 64 69 66 20 2f 2a 20 6b | 43 6f 6d 70 69 6c 65 57 |dif /* k|CompileW|
|000030d0| 69 74 68 43 47 49 41 63 | 74 69 6f 6e 53 75 70 70 |ithCGIAc|tionSupp|
|000030e0| 6f 72 74 20 2a 2f 0d 0d | 0d 2f 2a 2a 20 20 43 48 |ort */..|./** CH|
|000030f0| 41 52 41 43 54 45 52 20 | 43 4f 44 49 4e 47 20 20 |ARACTER |CODING |
|00003100| 2a 2a 2f 0d 23 70 72 61 | 67 6d 61 20 6d 61 72 6b |**/.#pra|gma mark|
|00003110| 20 2d 0d 0d 2f 2a 20 72 | 65 70 6c 61 63 65 73 20 | -../* r|eplaces |
|00003120| 69 6e 73 74 61 6e 63 65 | 73 20 6f 66 20 70 65 72 |instance|s of per|
|00003130| 63 65 6e 74 20 73 69 67 | 6e 73 20 28 25 29 20 66 |cent sig|ns (%) f|
|00003140| 6f 6c 6c 6f 77 65 64 20 | 62 79 20 61 6e 20 41 53 |ollowed |by an AS|
|00003150| 43 49 49 20 63 68 61 72 | 20 76 61 6c 75 65 0d 09 |CII char| value..|
|00003160| 77 69 74 68 20 74 68 65 | 20 61 63 74 75 61 6c 20 |with the| actual |
|00003170| 63 68 61 72 61 63 74 65 | 72 2e 0d 09 54 68 69 73 |characte|r...This|
|00003180| 20 66 75 6e 63 74 69 6f | 6e 20 6d 6f 64 69 66 69 | functio|n modifi|
|00003190| 65 73 20 74 68 65 53 74 | 72 69 6e 67 20 70 61 72 |es theSt|ring par|
|000031a0| 61 6d 65 74 65 72 21 20 | 2a 2f 0d 76 6f 69 64 0d |ameter! |*/.void.|
|000031b0| 43 47 49 44 65 63 6f 64 | 65 53 70 65 63 69 61 6c |CGIDecod|eSpecial|
|000031c0| 43 68 61 72 73 20 28 20 | 63 68 61 72 20 2a 74 68 |Chars ( |char *th|
|000031d0| 65 53 74 72 69 6e 67 20 | 29 0d 7b 0d 09 69 6e 74 |eString |).{..int|
|000031e0| 09 09 09 09 72 65 61 64 | 3b 0d 09 69 6e 74 09 09 |....read|;..int..|
|000031f0| 09 09 77 72 69 74 65 3b | 0d 09 75 6e 73 69 67 6e |..write;|..unsign|
|00003200| 65 64 20 63 68 61 72 09 | 74 68 65 43 68 61 72 3b |ed char.|theChar;|
|00003210| 0d 09 75 6e 73 69 67 6e | 65 64 20 63 68 61 72 09 |..unsign|ed char.|
|00003220| 68 69 67 68 4f 72 64 65 | 72 3b 0d 09 75 6e 73 69 |highOrde|r;..unsi|
|00003230| 67 6e 65 64 20 63 68 61 | 72 09 6c 6f 77 4f 72 64 |gned cha|r.lowOrd|
|00003240| 65 72 3b 0d 09 42 6f 6f | 6c 65 61 6e 09 09 09 69 |er;..Boo|lean...i|
|00003250| 73 56 61 6c 69 64 3b 0d | 09 0d 09 6d 79 5f 61 73 |sValid;.|...my_as|
|00003260| 73 65 72 74 20 28 20 74 | 68 65 53 74 72 69 6e 67 |sert ( t|heString|
|00003270| 20 21 3d 20 6e 69 6c 2c | 20 22 5c 70 43 47 49 44 | != nil,| "\pCGID|
|00003280| 65 63 6f 64 65 53 70 65 | 63 69 61 6c 43 68 61 72 |ecodeSpe|cialChar|
|00003290| 73 3a 20 6e 69 6c 20 73 | 74 72 69 6e 67 22 20 29 |s: nil s|tring" )|
|000032a0| 3b 0d 09 0d 09 72 65 61 | 64 09 3d 20 6e 69 6c 3b |;....rea|d.= nil;|
|000032b0| 0d 09 77 72 69 74 65 09 | 3d 20 6e 69 6c 3b 0d 09 |..write.|= nil;..|
|000032c0| 0d 09 77 68 69 6c 65 20 | 28 20 74 68 65 53 74 72 |..while |( theStr|
|000032d0| 69 6e 67 5b 72 65 61 64 | 5d 20 21 3d 20 6e 69 6c |ing[read|] != nil|
|000032e0| 20 29 0d 09 7b 0d 09 09 | 73 77 69 74 63 68 20 28 | )..{...|switch (|
|000032f0| 20 74 68 65 53 74 72 69 | 6e 67 5b 72 65 61 64 5d | theStri|ng[read]|
|00003300| 20 29 0d 09 09 7b 0d 09 | 09 09 63 61 73 65 20 27 | )...{..|..case '|
|00003310| 25 27 3a 0d 09 09 09 09 | 2f 2a 20 61 20 70 65 72 |%':.....|/* a per|
|00003320| 63 65 6e 74 20 73 79 6d | 62 6f 6c 20 62 65 67 69 |cent sym|bol begi|
|00003330| 6e 73 20 61 20 68 65 78 | 20 63 68 61 72 20 62 6c |ns a hex| char bl|
|00003340| 6f 63 6b 20 28 25 23 23 | 20 77 68 65 72 65 20 23 |ock (%##| where #|
|00003350| 23 20 69 73 20 74 68 65 | 20 68 65 78 20 76 61 6c |# is the| hex val|
|00003360| 75 65 29 20 2a 2f 0d 09 | 09 09 09 0d 09 09 09 09 |ue) */..|........|
|00003370| 69 73 56 61 6c 69 64 20 | 3d 20 74 72 75 65 3b 0d |isValid |= true;.|
|00003380| 09 09 09 09 0d 09 09 09 | 09 2f 2a 20 64 65 74 65 |........|./* dete|
|00003390| 72 6d 69 6e 65 20 68 69 | 67 68 20 6f 72 64 65 72 |rmine hi|gh order|
|000033a0| 20 68 65 78 20 63 68 61 | 72 61 63 74 65 72 20 2a | hex cha|racter *|
|000033b0| 2f 0d 09 09 09 09 69 66 | 20 28 20 28 74 68 65 53 |/.....if| ( (theS|
|000033c0| 74 72 69 6e 67 5b 72 65 | 61 64 2b 31 5d 20 3e 3d |tring[re|ad+1] >=|
|000033d0| 20 27 41 27 29 20 26 26 | 20 28 74 68 65 53 74 72 | 'A') &&| (theStr|
|000033e0| 69 6e 67 5b 72 65 61 64 | 2b 31 5d 20 3c 3d 20 27 |ing[read|+1] <= '|
|000033f0| 46 27 29 20 29 0d 09 09 | 09 09 7b 0d 09 09 09 09 |F') )...|..{.....|
|00003400| 09 2f 2a 20 75 70 70 65 | 72 63 61 73 65 20 41 2d |./* uppe|rcase A-|
|00003410| 46 20 63 6f 6e 76 65 72 | 74 20 74 6f 20 31 30 2d |F conver|t to 10-|
|00003420| 31 35 20 2a 2f 0d 09 09 | 09 09 09 68 69 67 68 4f |15 */...|...highO|
|00003430| 72 64 65 72 20 3d 20 74 | 68 65 53 74 72 69 6e 67 |rder = t|heString|
|00003440| 5b 72 65 61 64 2b 31 5d | 20 2d 20 27 41 27 20 2b |[read+1]| - 'A' +|
|00003450| 20 31 30 3b 0d 09 09 09 | 09 7d 0d 09 09 09 09 65 | 10;....|.}.....e|
|00003460| 6c 73 65 20 69 66 20 28 | 20 28 74 68 65 53 74 72 |lse if (| (theStr|
|00003470| 69 6e 67 5b 72 65 61 64 | 2b 31 5d 20 3e 3d 20 27 |ing[read|+1] >= '|
|00003480| 61 27 29 20 26 26 20 28 | 74 68 65 53 74 72 69 6e |a') && (|theStrin|
|00003490| 67 5b 72 65 61 64 2b 31 | 5d 20 3c 3d 20 27 66 27 |g[read+1|] <= 'f'|
|000034a0| 29 20 29 0d 09 09 09 09 | 7b 0d 09 09 09 09 09 2f |) ).....|{....../|
|000034b0| 2a 20 6c 6f 77 65 72 63 | 61 73 65 20 61 2d 66 20 |* lowerc|ase a-f |
|000034c0| 63 6f 6e 76 65 72 74 20 | 74 6f 20 31 30 2d 31 35 |convert |to 10-15|
|000034d0| 20 2a 2f 0d 09 09 09 09 | 09 68 69 67 68 4f 72 64 | */.....|.highOrd|
|000034e0| 65 72 20 3d 20 74 68 65 | 53 74 72 69 6e 67 5b 72 |er = the|String[r|
|000034f0| 65 61 64 2b 31 5d 20 2d | 20 27 61 27 20 2b 20 31 |ead+1] -| 'a' + 1|
|00003500| 30 3b 0d 09 09 09 09 7d | 0d 09 09 09 09 65 6c 73 |0;.....}|.....els|
|00003510| 65 20 69 66 20 28 20 28 | 74 68 65 53 74 72 69 6e |e if ( (|theStrin|
|00003520| 67 5b 72 65 61 64 2b 31 | 5d 20 3e 3d 20 27 30 27 |g[read+1|] >= '0'|
|00003530| 29 20 26 26 20 28 74 68 | 65 53 74 72 69 6e 67 5b |) && (th|eString[|
|00003540| 72 65 61 64 2b 31 5d 20 | 3c 3d 20 27 39 27 29 20 |read+1] |<= '9') |
|00003550| 29 0d 09 09 09 09 7b 0d | 09 09 09 09 09 2f 2a 20 |).....{.|...../* |
|00003560| 63 68 61 72 61 63 74 65 | 72 20 64 69 67 69 74 73 |characte|r digits|
|00003570| 20 30 2d 39 20 63 6f 6e | 76 65 72 74 20 74 6f 20 | 0-9 con|vert to |
|00003580| 64 65 63 69 6d 61 6c 20 | 30 2d 39 20 2a 2f 0d 09 |decimal |0-9 */..|
|00003590| 09 09 09 09 68 69 67 68 | 4f 72 64 65 72 20 3d 20 |....high|Order = |
|000035a0| 74 68 65 53 74 72 69 6e | 67 5b 72 65 61 64 2b 31 |theStrin|g[read+1|
|000035b0| 5d 20 2d 20 27 30 27 3b | 0d 09 09 09 09 7d 0d 09 |] - '0';|.....}..|
|000035c0| 09 09 09 65 6c 73 65 0d | 09 09 09 09 7b 0d 09 09 |...else.|....{...|
|000035d0| 09 09 09 2f 2a 20 49 6c | 6c 65 67 61 6c 20 63 68 |.../* Il|legal ch|
|000035e0| 61 72 61 63 74 65 72 21 | 20 43 61 6e 27 74 20 63 |aracter!| Can't c|
|000035f0| 6f 6e 76 65 72 74 20 66 | 72 6f 6d 20 68 65 78 20 |onvert f|rom hex |
|00003600| 2a 2f 0d 09 09 09 09 09 | 69 73 56 61 6c 69 64 20 |*/......|isValid |
|00003610| 3d 20 66 61 6c 73 65 3b | 0d 09 09 09 09 7d 0d 09 |= false;|.....}..|
|00003620| 09 09 09 0d 09 09 09 09 | 2f 2a 20 4d 75 6c 74 69 |........|/* Multi|
|00003630| 70 6c 79 20 68 69 67 68 | 20 6f 72 64 65 72 20 68 |ply high| order h|
|00003640| 65 78 20 64 69 67 69 74 | 20 62 79 20 31 36 20 2a |ex digit| by 16 *|
|00003650| 2f 0d 09 09 09 09 68 69 | 67 68 4f 72 64 65 72 20 |/.....hi|ghOrder |
|00003660| 2a 3d 20 31 36 3b 0d 09 | 09 09 09 0d 09 09 09 09 |*= 16;..|........|
|00003670| 2f 2a 20 64 65 74 65 72 | 6d 69 6e 65 20 6c 6f 77 |/* deter|mine low|
|00003680| 20 6f 72 64 65 72 20 68 | 65 78 20 63 68 61 72 61 | order h|ex chara|
|00003690| 63 74 65 72 20 2a 2f 0d | 09 09 09 09 69 66 20 28 |cter */.|....if (|
|000036a0| 20 28 74 68 65 53 74 72 | 69 6e 67 5b 72 65 61 64 | (theStr|ing[read|
|000036b0| 2b 32 5d 20 3e 3d 20 27 | 41 27 29 20 26 26 20 28 |+2] >= '|A') && (|
|000036c0| 74 68 65 53 74 72 69 6e | 67 5b 72 65 61 64 2b 32 |theStrin|g[read+2|
|000036d0| 5d 20 3c 3d 20 27 46 27 | 29 20 29 0d 09 09 09 09 |] <= 'F'|) ).....|
|000036e0| 7b 0d 09 09 09 09 09 2f | 2a 20 75 70 70 65 72 63 |{....../|* upperc|
|000036f0| 61 73 65 20 41 2d 46 20 | 63 6f 6e 76 65 72 74 20 |ase A-F |convert |
|00003700| 74 6f 20 31 30 2d 31 35 | 20 2a 2f 0d 09 09 09 09 |to 10-15| */.....|
|00003710| 09 6c 6f 77 4f 72 64 65 | 72 20 3d 20 28 74 68 65 |.lowOrde|r = (the|
|00003720| 53 74 72 69 6e 67 5b 72 | 65 61 64 2b 32 5d 20 2d |String[r|ead+2] -|
|00003730| 20 27 41 27 20 2b 20 31 | 30 29 3b 0d 09 09 09 09 | 'A' + 1|0);.....|
|00003740| 7d 0d 09 09 09 09 65 6c | 73 65 20 69 66 20 28 20 |}.....el|se if ( |
|00003750| 28 74 68 65 53 74 72 69 | 6e 67 5b 72 65 61 64 2b |(theStri|ng[read+|
|00003760| 32 5d 20 3e 3d 20 27 61 | 27 29 20 26 26 20 28 74 |2] >= 'a|') && (t|
|00003770| 68 65 53 74 72 69 6e 67 | 5b 72 65 61 64 2b 32 5d |heString|[read+2]|
|00003780| 20 3c 3d 20 27 66 27 29 | 20 29 0d 09 09 09 09 7b | <= 'f')| ).....{|
|00003790| 0d 09 09 09 09 09 2f 2a | 20 6c 6f 77 65 72 63 61 |....../*| lowerca|
|000037a0| 73 65 20 61 2d 66 20 63 | 6f 6e 76 65 72 74 20 74 |se a-f c|onvert t|
|000037b0| 6f 20 31 30 2d 31 35 20 | 2a 2f 0d 09 09 09 09 09 |o 10-15 |*/......|
|000037c0| 6c 6f 77 4f 72 64 65 72 | 20 3d 20 28 74 68 65 53 |lowOrder| = (theS|
|000037d0| 74 72 69 6e 67 5b 72 65 | 61 64 2b 32 5d 20 2d 20 |tring[re|ad+2] - |
|000037e0| 27 61 27 20 2b 20 31 30 | 29 3b 0d 09 09 09 09 7d |'a' + 10|);.....}|
|000037f0| 0d 09 09 09 09 65 6c 73 | 65 20 69 66 20 28 20 28 |.....els|e if ( (|
|00003800| 74 68 65 53 74 72 69 6e | 67 5b 72 65 61 64 2b 32 |theStrin|g[read+2|
|00003810| 5d 20 3e 3d 20 27 30 27 | 29 20 26 26 20 28 74 68 |] >= '0'|) && (th|
|00003820| 65 53 74 72 69 6e 67 5b | 72 65 61 64 2b 32 5d 20 |eString[|read+2] |
|00003830| 3c 3d 20 27 39 27 29 20 | 29 0d 09 09 09 09 7b 0d |<= '9') |).....{.|
|00003840| 09 09 09 09 09 2f 2a 20 | 63 68 61 72 61 63 74 65 |...../* |characte|
|00003850| 72 20 64 69 67 69 74 73 | 20 30 2d 39 20 63 6f 6e |r digits| 0-9 con|
|00003860| 76 65 72 74 20 74 6f 20 | 64 65 63 69 6d 61 6c 20 |vert to |decimal |
|00003870| 30 2d 39 20 2a 2f 0d 09 | 09 09 09 09 6c 6f 77 4f |0-9 */..|....lowO|
|00003880| 72 64 65 72 20 3d 20 28 | 74 68 65 53 74 72 69 6e |rder = (|theStrin|
|00003890| 67 5b 72 65 61 64 2b 32 | 5d 20 2d 20 27 30 27 29 |g[read+2|] - '0')|
|000038a0| 3b 0d 09 09 09 09 7d 0d | 09 09 09 09 65 6c 73 65 |;.....}.|....else|
|000038b0| 0d 09 09 09 09 7b 0d 09 | 09 09 09 09 2f 2a 20 49 |.....{..|..../* I|
|000038c0| 6c 6c 65 67 61 6c 20 63 | 68 61 72 61 63 74 65 72 |llegal c|haracter|
|000038d0| 21 20 43 61 6e 27 74 20 | 63 6f 6e 76 65 72 74 20 |! Can't |convert |
|000038e0| 66 72 6f 6d 20 68 65 78 | 20 2a 2f 0d 09 09 09 09 |from hex| */.....|
|000038f0| 09 69 73 56 61 6c 69 64 | 20 3d 20 66 61 6c 73 65 |.isValid| = false|
|00003900| 3b 0d 09 09 09 09 7d 0d | 09 09 09 09 0d 09 09 09 |;.....}.|........|
|00003910| 09 74 68 65 43 68 61 72 | 20 3d 20 68 69 67 68 4f |.theChar| = highO|
|00003920| 72 64 65 72 20 2b 20 6c | 6f 77 4f 72 64 65 72 3b |rder + l|owOrder;|
|00003930| 0d 09 09 09 09 0d 09 09 | 09 09 69 66 20 28 20 69 |........|..if ( i|
|00003940| 73 56 61 6c 69 64 20 29 | 0d 09 09 09 09 7b 0d 09 |sValid )|.....{..|
|00003950| 09 09 09 09 69 73 56 61 | 6c 69 64 20 3d 20 28 74 |....isVa|lid = (t|
|00003960| 68 65 43 68 61 72 20 3e | 3d 20 30 29 20 26 26 20 |heChar >|= 0) && |
|00003970| 28 74 68 65 43 68 61 72 | 20 3c 20 32 35 36 29 3b |(theChar| < 256);|
|00003980| 0d 09 09 09 09 7d 0d 09 | 09 09 09 0d 09 09 09 09 |.....}..|........|
|00003990| 69 66 20 28 20 69 73 56 | 61 6c 69 64 20 29 0d 09 |if ( isV|alid )..|
|000039a0| 09 09 09 7b 0d 09 09 09 | 09 09 2f 2a 20 69 66 20 |...{....|../* if |
|000039b0| 74 68 65 43 68 61 72 20 | 69 73 20 76 61 6c 69 64 |theChar |is valid|
|000039c0| 2c 20 77 72 69 74 65 20 | 69 74 20 6f 75 74 20 2a |, write |it out *|
|000039d0| 2f 0d 09 09 09 09 09 0d | 09 09 09 09 09 69 66 20 |/.......|.....if |
|000039e0| 28 20 74 68 65 43 68 61 | 72 20 3d 3d 20 31 30 20 |( theCha|r == 10 |
|000039f0| 29 0d 09 09 09 09 09 7b | 0d 09 09 09 09 09 09 2f |)......{|......./|
|00003a00| 2a 20 64 6f 6e 27 74 20 | 77 72 69 74 65 20 6e 65 |* don't |write ne|
|00003a10| 77 6c 69 6e 65 20 2a 2f | 0d 09 09 09 09 09 09 77 |wline */|.......w|
|00003a20| 72 69 74 65 2d 2d 3b 0d | 09 09 09 09 09 7d 0d 09 |rite--;.|.....}..|
|00003a30| 09 09 09 09 65 6c 73 65 | 0d 09 09 09 09 09 7b 0d |....else|......{.|
|00003a40| 09 09 09 09 09 09 74 68 | 65 53 74 72 69 6e 67 5b |......th|eString[|
|00003a50| 77 72 69 74 65 5d 20 3d | 20 74 68 65 43 68 61 72 |write] =| theChar|
|00003a60| 3b 0d 09 09 09 09 09 7d | 0d 09 09 09 09 09 0d 09 |;......}|........|
|00003a70| 09 09 09 09 2f 2a 20 49 | 6e 63 72 65 6d 65 6e 74 |..../* I|ncrement|
|00003a80| 20 72 65 61 64 20 70 61 | 73 74 20 74 68 65 20 74 | read pa|st the t|
|00003a90| 77 6f 20 64 69 67 69 74 | 73 20 6f 66 20 74 68 65 |wo digit|s of the|
|00003aa0| 20 68 65 78 20 63 6f 64 | 65 20 2a 2f 0d 09 09 09 | hex cod|e */....|
|00003ab0| 09 09 72 65 61 64 20 2b | 3d 20 32 3b 0d 09 09 09 |..read +|= 2;....|
|00003ac0| 09 7d 0d 09 09 09 09 65 | 6c 73 65 0d 09 09 09 09 |.}.....e|lse.....|
|00003ad0| 7b 0d 09 09 09 09 09 2f | 2a 20 69 6e 76 61 6c 69 |{....../|* invali|
|00003ae0| 64 20 68 65 78 20 63 68 | 61 72 61 63 74 65 72 20 |d hex ch|aracter |
|00003af0| 63 6f 64 65 2c 20 6a 75 | 73 74 20 77 72 69 74 65 |code, ju|st write|
|00003b00| 20 6f 75 74 20 74 68 65 | 20 70 65 72 63 65 6e 74 | out the| percent|
|00003b10| 20 73 79 6d 62 6f 6c 20 | 2a 2f 0d 09 09 09 09 09 | symbol |*/......|
|00003b20| 74 68 65 53 74 72 69 6e | 67 5b 77 72 69 74 65 5d |theStrin|g[write]|
|00003b30| 20 3d 20 74 68 65 53 74 | 72 69 6e 67 5b 72 65 61 | = theSt|ring[rea|
|00003b40| 64 5d 3b 0d 09 09 09 09 | 7d 0d 09 09 09 09 62 72 |d];.....|}.....br|
|00003b50| 65 61 6b 3b 0d 09 09 09 | 0d 09 09 09 63 61 73 65 |eak;....|....case|
|00003b60| 20 27 2b 27 3a 0d 09 09 | 09 09 2f 2a 20 50 6c 75 | '+':...|../* Plu|
|00003b70| 73 20 73 79 6d 62 6f 6c | 73 20 63 6f 6e 76 65 72 |s symbol|s conver|
|00003b80| 74 20 74 6f 20 73 70 61 | 63 65 20 2a 2f 0d 09 09 |t to spa|ce */...|
|00003b90| 09 09 74 68 65 53 74 72 | 69 6e 67 5b 77 72 69 74 |..theStr|ing[writ|
|00003ba0| 65 5d 20 3d 20 27 20 27 | 3b 0d 09 09 09 09 62 72 |e] = ' '|;.....br|
|00003bb0| 65 61 6b 3b 0d 09 09 09 | 09 0d 09 09 09 63 61 73 |eak;....|.....cas|
|00003bc0| 65 20 31 30 3a 0d 09 09 | 09 09 2f 2a 20 69 67 6e |e 10:...|../* ign|
|00003bd0| 6f 72 65 20 6c 69 6e 65 | 20 66 65 65 64 73 2c 20 |ore line| feeds, |
|00003be0| 77 65 20 6f 6e 6c 79 20 | 6e 65 65 64 20 63 61 72 |we only |need car|
|00003bf0| 72 69 61 67 65 20 72 65 | 74 75 72 6e 73 20 28 31 |riage re|turns (1|
|00003c00| 33 29 20 2a 2f 0d 09 09 | 09 09 77 72 69 74 65 2d |3) */...|..write-|
|00003c10| 2d 3b 0d 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |-;.....b|reak;...|
|00003c20| 09 09 0d 09 09 09 64 65 | 66 61 75 6c 74 3a 0d 09 |......de|fault:..|
|00003c30| 09 09 09 2f 2a 20 77 72 | 69 74 65 20 6f 75 74 20 |.../* wr|ite out |
|00003c40| 74 68 65 20 63 68 61 72 | 61 63 74 65 72 20 2a 2f |the char|acter */|
|00003c50| 0d 09 09 09 09 74 68 65 | 53 74 72 69 6e 67 5b 77 |.....the|String[w|
|00003c60| 72 69 74 65 5d 20 3d 20 | 74 68 65 53 74 72 69 6e |rite] = |theStrin|
|00003c70| 67 5b 72 65 61 64 5d 3b | 0d 09 09 09 09 62 72 65 |g[read];|.....bre|
|00003c80| 61 6b 3b 0d 09 09 7d 0d | 09 09 09 0d 09 09 72 65 |ak;...}.|......re|
|00003c90| 61 64 2b 2b 3b 0d 09 09 | 77 72 69 74 65 2b 2b 3b |ad++;...|write++;|
|00003ca0| 0d 09 7d 0d 09 0d 09 2f | 2a 20 74 65 72 6d 69 6e |..}..../|* termin|
|00003cb0| 61 74 65 20 74 68 65 20 | 73 74 72 69 6e 67 20 2a |ate the |string *|
|00003cc0| 2f 0d 09 74 68 65 53 74 | 72 69 6e 67 5b 77 72 69 |/..theSt|ring[wri|
|00003cd0| 74 65 5d 20 3d 20 27 5c | 30 27 3b 0d 7d 20 2f 2a |te] = '\|0';.} /*|
|00003ce0| 20 43 47 49 44 65 63 6f | 64 65 53 70 65 63 69 61 | CGIDeco|deSpecia|
|00003cf0| 6c 43 68 61 72 73 20 2a | 2f 0d 0d 0d 23 64 65 66 |lChars *|/...#def|
|00003d00| 69 6e 65 20 6b 43 47 49 | 45 6e 63 6f 64 65 45 78 |ine kCGI|EncodeEx|
|00003d10| 74 72 61 43 68 61 72 73 | 09 09 31 36 0d 0d 2f 2a |traChars|..16../*|
|00003d20| 20 25 68 65 78 20 65 6e | 63 6f 64 65 20 61 6c 6c | %hex en|code all|
|00003d30| 20 6e 6f 6e 2d 61 6c 70 | 68 61 6e 75 6d 65 72 69 | non-alp|hanumeri|
|00003d40| 63 20 63 68 61 72 61 63 | 74 65 72 73 0d 09 74 68 |c charac|ters..th|
|00003d50| 65 53 74 72 69 6e 67 20 | 70 61 72 61 6d 65 74 65 |eString |paramete|
|00003d60| 72 20 69 73 20 6e 6f 74 | 20 6d 6f 64 69 66 69 65 |r is not| modifie|
|00003d70| 64 20 2a 2f 0d 63 68 61 | 72 20 2a 0d 43 47 49 45 |d */.cha|r *.CGIE|
|00003d80| 6e 63 6f 64 65 53 70 65 | 63 69 61 6c 43 68 61 72 |ncodeSpe|cialChar|
|00003d90| 73 20 28 20 63 68 61 72 | 20 2a 74 68 65 53 74 72 |s ( char| *theStr|
|00003da0| 69 6e 67 20 29 0d 7b 0d | 09 63 68 61 72 20 2a 09 |ing ).{.|.char *.|
|00003db0| 74 68 65 52 65 73 75 6c | 74 3b 0d 09 6c 6f 6e 67 |theResul|t;..long|
|00003dc0| 09 73 74 72 53 69 7a 65 | 3b 09 09 2f 2a 20 73 69 |.strSize|;../* si|
|00003dd0| 7a 65 20 6f 66 20 74 68 | 65 20 73 6f 75 72 63 65 |ze of th|e source|
|00003de0| 20 73 74 72 69 6e 67 20 | 2a 2f 0d 09 6c 6f 6e 67 | string |*/..long|
|00003df0| 09 74 65 6d 70 53 69 7a | 65 3b 09 09 2f 2a 20 63 |.tempSiz|e;../* c|
|00003e00| 75 72 72 65 6e 74 20 73 | 69 7a 65 20 6f 66 20 74 |urrent s|ize of t|
|00003e10| 68 65 20 72 65 73 75 6c | 74 20 2a 2f 0d 09 6c 6f |he resul|t */..lo|
|00003e20| 6e 67 09 73 74 72 4f 66 | 66 73 65 74 3b 09 09 2f |ng.strOf|fset;../|
|00003e30| 2a 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 63 75 72 |* pointe|r to cur|
|00003e40| 72 65 6e 74 20 72 65 61 | 64 20 70 6f 73 69 74 69 |rent rea|d positi|
|00003e50| 6f 6e 20 69 6e 20 74 68 | 65 20 73 6f 75 72 63 65 |on in th|e source|
|00003e60| 20 73 74 72 69 6e 67 20 | 2a 2f 0d 09 6c 6f 6e 67 | string |*/..long|
|00003e70| 09 72 65 73 75 6c 74 4f | 66 66 73 65 74 3b 09 2f |.resultO|ffset;./|
|00003e80| 2a 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 63 75 72 |* pointe|r to cur|
|00003e90| 72 65 6e 74 20 77 72 69 | 74 65 20 70 6f 73 69 74 |rent wri|te posit|
|00003ea0| 69 6f 6e 20 69 6e 20 74 | 68 65 20 72 65 73 75 6c |ion in t|he resul|
|00003eb0| 74 20 73 74 72 69 6e 67 | 20 2a 2f 0d 09 0d 09 73 |t string| */....s|
|00003ec0| 74 72 53 69 7a 65 09 09 | 3d 20 73 74 72 6c 65 6e |trSize..|= strlen|
|00003ed0| 20 28 20 74 68 65 53 74 | 72 69 6e 67 20 29 3b 0d | ( theSt|ring );.|
|00003ee0| 09 74 65 6d 70 53 69 7a | 65 09 3d 20 73 74 72 53 |.tempSiz|e.= strS|
|00003ef0| 69 7a 65 20 2b 20 6b 43 | 47 49 45 6e 63 6f 64 65 |ize + kC|GIEncode|
|00003f00| 45 78 74 72 61 43 68 61 | 72 73 3b 0d 09 74 68 65 |ExtraCha|rs;..the|
|00003f10| 52 65 73 75 6c 74 09 3d | 20 28 63 68 61 72 20 2a |Result.=| (char *|
|00003f20| 29 20 4d 79 4e 65 77 50 | 74 72 20 28 20 28 74 65 |) MyNewP|tr ( (te|
|00003f30| 6d 70 53 69 7a 65 20 2b | 20 31 29 2c 20 6e 69 6c |mpSize +| 1), nil|
|00003f40| 20 29 3b 0d 09 0d 09 66 | 6f 72 20 28 20 73 74 72 | );....f|or ( str|
|00003f50| 4f 66 66 73 65 74 20 3d | 20 72 65 73 75 6c 74 4f |Offset =| resultO|
|00003f60| 66 66 73 65 74 20 3d 20 | 6e 69 6c 3b 20 73 74 72 |ffset = |nil; str|
|00003f70| 4f 66 66 73 65 74 20 3c | 20 73 74 72 53 69 7a 65 |Offset <| strSize|
|00003f80| 3b 20 73 74 72 4f 66 66 | 73 65 74 2b 2b 2c 20 72 |; strOff|set++, r|
|00003f90| 65 73 75 6c 74 4f 66 66 | 73 65 74 2b 2b 20 29 0d |esultOff|set++ ).|
|00003fa0| 09 7b 0d 09 09 69 66 20 | 28 20 72 65 73 75 6c 74 |.{...if |( result|
|00003fb0| 4f 66 66 73 65 74 20 3e | 20 74 65 6d 70 53 69 7a |Offset >| tempSiz|
|00003fc0| 65 20 29 0d 09 09 7b 0d | 09 09 09 2f 2a 20 74 68 |e )...{.|.../* th|
|00003fd0| 65 20 63 75 72 72 65 6e | 74 20 73 69 7a 65 20 6f |e curren|t size o|
|00003fe0| 66 20 74 68 65 20 72 65 | 73 75 6c 74 20 73 74 72 |f the re|sult str|
|00003ff0| 69 6e 67 20 69 73 6e 27 | 74 20 62 69 67 20 65 6e |ing isn'|t big en|
|00004000| 6f 75 67 68 2c 20 73 6f | 20 67 72 6f 77 20 69 74 |ough, so| grow it|
|00004010| 20 2a 2f 0d 09 09 09 2f | 2a 20 a5 a5 a5 20 63 68 | */..../|* ... ch|
|00004020| 65 63 6b 20 69 66 20 74 | 68 65 72 65 20 6d 61 79 |eck if t|here may|
|00004030| 20 62 65 20 65 72 72 6f | 72 73 20 69 66 20 74 68 | be erro|rs if th|
|00004040| 65 20 67 72 6f 77 20 66 | 61 69 6c 73 20 2a 2f 0d |e grow f|ails */.|
|00004050| 09 09 09 74 65 6d 70 53 | 69 7a 65 20 2b 3d 20 6b |...tempS|ize += k|
|00004060| 43 47 49 45 6e 63 6f 64 | 65 45 78 74 72 61 43 68 |CGIEncod|eExtraCh|
|00004070| 61 72 73 3b 0d 09 09 09 | 53 65 74 50 74 72 53 69 |ars;....|SetPtrSi|
|00004080| 7a 65 20 28 20 28 50 74 | 72 29 74 68 65 52 65 73 |ze ( (Pt|r)theRes|
|00004090| 75 6c 74 2c 20 74 65 6d | 70 53 69 7a 65 20 2b 20 |ult, tem|pSize + |
|000040a0| 31 20 29 3b 0d 09 09 7d | 0d 09 09 0d 09 09 69 66 |1 );...}|......if|
|000040b0| 20 28 20 28 28 74 68 65 | 53 74 72 69 6e 67 5b 73 | ( ((the|String[s|
|000040c0| 74 72 4f 66 66 73 65 74 | 5d 20 3e 3d 20 27 30 27 |trOffset|] >= '0'|
|000040d0| 29 20 26 26 20 28 74 68 | 65 53 74 72 69 6e 67 5b |) && (th|eString[|
|000040e0| 73 74 72 4f 66 66 73 65 | 74 5d 20 3c 3d 20 27 39 |strOffse|t] <= '9|
|000040f0| 27 29 29 20 7c 7c 0d 09 | 09 09 28 28 74 68 65 53 |')) ||..|..((theS|
|00004100| 74 72 69 6e 67 5b 73 74 | 72 4f 66 66 73 65 74 5d |tring[st|rOffset]|
|00004110| 20 3e 3d 20 27 41 27 29 | 20 26 26 20 28 74 68 65 | >= 'A')| && (the|
|00004120| 53 74 72 69 6e 67 5b 73 | 74 72 4f 66 66 73 65 74 |String[s|trOffset|
|00004130| 5d 20 3c 3d 20 27 5a 27 | 29 29 20 7c 7c 0d 09 09 |] <= 'Z'|)) ||...|
|00004140| 09 28 28 74 68 65 53 74 | 72 69 6e 67 5b 73 74 72 |.((theSt|ring[str|
|00004150| 4f 66 66 73 65 74 5d 20 | 3e 3d 20 27 61 27 29 20 |Offset] |>= 'a') |
|00004160| 26 26 20 28 74 68 65 53 | 74 72 69 6e 67 5b 73 74 |&& (theS|tring[st|
|00004170| 72 4f 66 66 73 65 74 5d | 20 3c 3d 20 27 7a 27 29 |rOffset]| <= 'z')|
|00004180| 29 20 29 0d 09 09 7b 0d | 09 09 09 2f 2a 20 69 66 |) )...{.|.../* if|
|00004190| 20 74 68 65 20 63 68 61 | 72 61 63 74 65 72 20 69 | the cha|racter i|
|000041a0| 73 20 61 6c 70 68 61 6e | 75 6d 65 72 69 63 20 6a |s alphan|umeric j|
|000041b0| 75 73 74 20 63 6f 70 79 | 20 69 74 20 2a 2f 0d 09 |ust copy| it */..|
|000041c0| 09 09 74 68 65 52 65 73 | 75 6c 74 5b 72 65 73 75 |..theRes|ult[resu|
|000041d0| 6c 74 4f 66 66 73 65 74 | 5d 20 3d 20 74 68 65 53 |ltOffset|] = theS|
|000041e0| 74 72 69 6e 67 5b 73 74 | 72 4f 66 66 73 65 74 5d |tring[st|rOffset]|
|000041f0| 3b 0d 09 09 7d 0d 09 09 | 65 6c 73 65 0d 09 09 7b |;...}...|else...{|
|00004200| 0d 09 09 09 2f 2a 20 69 | 66 20 74 68 65 20 63 68 |..../* i|f the ch|
|00004210| 61 72 61 63 74 65 72 20 | 69 73 20 6e 6f 74 20 61 |aracter |is not a|
|00004220| 6c 70 68 61 6e 75 6d 65 | 72 69 63 2c 20 68 65 78 |lphanume|ric, hex|
|00004230| 20 65 6e 63 6f 64 65 20 | 69 74 20 2a 2f 0d 09 09 | encode |it */...|
|00004240| 09 0d 09 09 09 69 66 20 | 28 20 28 72 65 73 75 6c |.....if |( (resul|
|00004250| 74 4f 66 66 73 65 74 20 | 2b 20 32 29 20 3e 20 74 |tOffset |+ 2) > t|
|00004260| 65 6d 70 53 69 7a 65 20 | 29 0d 09 09 09 7b 0d 09 |empSize |)....{..|
|00004270| 09 09 09 23 69 66 20 6b | 43 6f 6d 70 69 6c 65 57 |...#if k|CompileW|
|00004280| 69 74 68 54 68 72 65 61 | 64 73 4f 70 74 69 6f 6e |ithThrea|dsOption|
|00004290| 61 6c 0d 09 09 09 09 69 | 66 20 28 20 67 48 61 73 |al.....i|f ( gHas|
|000042a0| 54 68 72 65 61 64 4d 67 | 72 20 29 0d 09 09 09 09 |ThreadMg|r ).....|
|000042b0| 23 65 6e 64 69 66 0d 09 | 09 09 09 7b 0d 09 09 09 |#endif..|...{....|
|000042c0| 09 09 2f 2a 20 74 68 69 | 73 20 6c 6f 6f 70 20 73 |../* thi|s loop s|
|000042d0| 68 6f 75 6c 64 20 62 65 | 20 71 75 69 74 65 20 66 |hould be| quite f|
|000042e0| 61 73 74 2c 20 62 75 74 | 20 77 65 27 6c 6c 20 79 |ast, but| we'll y|
|000042f0| 69 65 6c 64 20 69 66 20 | 77 65 0d 09 09 09 09 09 |ield if |we......|
|00004300| 09 68 61 76 65 20 74 6f | 20 73 74 61 72 74 20 67 |.have to| start g|
|00004310| 72 6f 77 69 6e 67 20 74 | 68 65 20 62 6c 6f 63 6b |rowing t|he block|
|00004320| 20 6f 66 20 77 6f 72 6b | 69 6e 67 20 6d 65 6d 6f | of work|ing memo|
|00004330| 72 79 20 28 74 68 65 52 | 65 73 75 6c 74 29 20 2a |ry (theR|esult) *|
|00004340| 2f 0d 09 09 09 09 09 59 | 69 65 6c 64 54 6f 41 6e |/......Y|ieldToAn|
|00004350| 79 54 68 72 65 61 64 20 | 28 29 3b 0d 09 09 09 09 |yThread |();.....|
|00004360| 7d 0d 09 09 09 09 0d 09 | 09 09 09 2f 2a 20 74 68 |}.......|.../* th|
|00004370| 65 20 63 75 72 72 65 6e | 74 20 73 69 7a 65 20 6f |e curren|t size o|
|00004380| 66 20 74 68 65 20 72 65 | 73 75 6c 74 20 73 74 72 |f the re|sult str|
|00004390| 69 6e 67 20 69 73 6e 27 | 74 20 62 69 67 20 65 6e |ing isn'|t big en|
|000043a0| 6f 75 67 68 2c 20 73 6f | 20 67 72 6f 77 20 69 74 |ough, so| grow it|
|000043b0| 20 2a 2f 0d 09 09 09 09 | 74 65 6d 70 53 69 7a 65 | */.....|tempSize|
|000043c0| 20 2b 3d 20 6b 43 47 49 | 45 6e 63 6f 64 65 45 78 | += kCGI|EncodeEx|
|000043d0| 74 72 61 43 68 61 72 73 | 3b 0d 09 09 09 09 53 65 |traChars|;.....Se|
|000043e0| 74 50 74 72 53 69 7a 65 | 20 28 20 28 50 74 72 29 |tPtrSize| ( (Ptr)|
|000043f0| 74 68 65 52 65 73 75 6c | 74 2c 20 74 65 6d 70 53 |theResul|t, tempS|
|00004400| 69 7a 65 20 2b 20 31 20 | 29 3b 0d 09 09 09 7d 0d |ize + 1 |);....}.|
|00004410| 09 09 0d 09 09 09 2f 2a | 20 68 65 78 20 65 6e 63 |....../*| hex enc|
|00004420| 6f 64 65 20 63 68 61 72 | 61 63 74 65 72 20 2a 2f |ode char|acter */|
|00004430| 0d 09 09 09 43 47 49 43 | 68 61 72 54 6f 48 65 78 |....CGIC|harToHex|
|00004440| 20 28 20 74 68 65 53 74 | 72 69 6e 67 5b 73 74 72 | ( theSt|ring[str|
|00004450| 4f 66 66 73 65 74 5d 2c | 20 26 28 74 68 65 52 65 |Offset],| &(theRe|
|00004460| 73 75 6c 74 5b 72 65 73 | 75 6c 74 4f 66 66 73 65 |sult[res|ultOffse|
|00004470| 74 5d 29 20 29 3b 0d 09 | 09 09 2f 2a 20 61 64 64 |t]) );..|../* add|
|00004480| 20 74 68 65 20 65 78 74 | 72 61 20 74 77 6f 20 63 | the ext|ra two c|
|00004490| 68 61 72 61 63 74 65 72 | 73 20 66 6f 72 20 68 65 |haracter|s for he|
|000044a0| 78 20 65 6e 63 6f 64 69 | 6e 67 20 74 6f 20 74 68 |x encodi|ng to th|
|000044b0| 65 20 72 65 73 75 6c 74 | 20 6f 66 66 73 65 74 20 |e result| offset |
|000044c0| 2a 2f 0d 09 09 09 72 65 | 73 75 6c 74 4f 66 66 73 |*/....re|sultOffs|
|000044d0| 65 74 20 2b 3d 20 32 3b | 0d 09 09 7d 0d 09 7d 0d |et += 2;|...}..}.|
|000044e0| 09 0d 09 2f 2a 20 69 6e | 63 72 65 6d 65 6e 74 20 |.../* in|crement |
|000044f0| 74 68 65 20 6f 66 66 73 | 65 74 20 74 6f 20 61 63 |the offs|et to ac|
|00004500| 63 6f 6d 6f 64 61 74 65 | 20 74 68 65 20 73 74 72 |comodate| the str|
|00004510| 69 6e 67 20 74 65 72 6d | 69 6e 61 74 6f 72 20 2a |ing term|inator *|
|00004520| 2f 0d 09 72 65 73 75 6c | 74 4f 66 66 73 65 74 2b |/..resul|tOffset+|
|00004530| 2b 3b 0d 09 0d 09 69 66 | 20 28 20 72 65 73 75 6c |+;....if| ( resul|
|00004540| 74 4f 66 66 73 65 74 20 | 3e 20 74 65 6d 70 53 69 |tOffset |> tempSi|
|00004550| 7a 65 20 29 0d 09 7b 0d | 09 09 2f 2a 20 74 68 65 |ze )..{.|../* the|
|00004560| 20 63 75 72 72 65 6e 74 | 20 73 69 7a 65 20 6f 66 | current| size of|
|00004570| 20 74 68 65 20 72 65 73 | 75 6c 74 20 73 74 72 69 | the res|ult stri|
|00004580| 6e 67 20 69 73 6e 27 74 | 20 62 69 67 20 65 6e 6f |ng isn't| big eno|
|00004590| 75 67 68 2c 20 73 6f 20 | 67 72 6f 77 20 69 74 20 |ugh, so |grow it |
|000045a0| 2a 2f 0d 09 09 74 65 6d | 70 53 69 7a 65 20 2b 3d |*/...tem|pSize +=|
|000045b0| 20 6b 43 47 49 45 6e 63 | 6f 64 65 45 78 74 72 61 | kCGIEnc|odeExtra|
|000045c0| 43 68 61 72 73 3b 0d 09 | 09 53 65 74 50 74 72 53 |Chars;..|.SetPtrS|
|000045d0| 69 7a 65 20 28 20 28 50 | 74 72 29 74 68 65 52 65 |ize ( (P|tr)theRe|
|000045e0| 73 75 6c 74 2c 20 74 65 | 6d 70 53 69 7a 65 20 2b |sult, te|mpSize +|
|000045f0| 20 31 20 29 3b 0d 09 7d | 0d 09 0d 09 2f 2a 20 74 | 1 );..}|..../* t|
|00004600| 65 72 6d 69 6e 61 74 65 | 20 74 68 65 20 73 74 72 |erminate| the str|
|00004610| 69 6e 67 20 2a 2f 0d 09 | 74 68 65 52 65 73 75 6c |ing */..|theResul|
|00004620| 74 5b 72 65 73 75 6c 74 | 4f 66 66 73 65 74 5d 20 |t[result|Offset] |
|00004630| 3d 20 6e 69 6c 3b 0d 09 | 0d 09 69 66 20 28 20 72 |= nil;..|..if ( r|
|00004640| 65 73 75 6c 74 4f 66 66 | 73 65 74 20 21 3d 20 74 |esultOff|set != t|
|00004650| 65 6d 70 53 69 7a 65 20 | 29 0d 09 7b 0d 09 09 2f |empSize |)..{.../|
|00004660| 2a 20 73 68 72 69 6e 6b | 20 74 68 65 20 6d 65 6d |* shrink| the mem|
|00004670| 6f 72 79 20 66 6f 72 20 | 74 68 65 20 72 65 73 75 |ory for |the resu|
|00004680| 6c 74 20 73 74 72 69 6e | 67 20 74 6f 20 65 78 61 |lt strin|g to exa|
|00004690| 63 74 6c 79 20 6d 61 74 | 63 68 20 69 74 27 73 20 |ctly mat|ch it's |
|000046a0| 6e 65 65 64 73 20 2a 2f | 0d 09 09 53 65 74 50 74 |needs */|...SetPt|
|000046b0| 72 53 69 7a 65 20 28 20 | 28 50 74 72 29 74 68 65 |rSize ( |(Ptr)the|
|000046c0| 52 65 73 75 6c 74 2c 20 | 72 65 73 75 6c 74 4f 66 |Result, |resultOf|
|000046d0| 66 73 65 74 20 2b 20 31 | 20 29 3b 0d 09 7d 0d 09 |fset + 1| );..}..|
|000046e0| 0d 09 72 65 74 75 72 6e | 20 74 68 65 52 65 73 75 |..return| theResu|
|000046f0| 6c 74 3b 0d 7d 20 2f 2a | 20 43 47 49 45 6e 63 6f |lt;.} /*| CGIEnco|
|00004700| 64 65 53 70 65 63 69 61 | 6c 43 68 61 72 73 20 2a |deSpecia|lChars *|
|00004710| 2f 0d 0d 0d 2f 2a 20 43 | 6f 6e 76 65 72 74 73 20 |/.../* C|onverts |
|00004720| 61 20 63 68 61 72 61 63 | 74 65 72 20 74 6f 20 70 |a charac|ter to p|
|00004730| 65 72 63 65 6e 74 2d 68 | 65 78 20 65 6e 63 6f 64 |ercent-h|ex encod|
|00004740| 69 6e 67 20 61 6e 64 20 | 77 72 69 74 65 73 20 74 |ing and |writes t|
|00004750| 68 61 74 20 74 6f 20 74 | 68 65 20 73 74 72 69 6e |hat to t|he strin|
|00004760| 67 2e 0d 09 54 68 69 73 | 20 61 73 73 75 6d 65 73 |g...This| assumes|
|00004770| 20 74 68 61 74 20 74 68 | 65 20 73 74 72 69 6e 67 | that th|e string|
|00004780| 20 69 73 20 61 74 20 6c | 65 61 73 74 20 34 20 62 | is at l|east 4 b|
|00004790| 79 74 65 73 20 6c 6f 6e | 67 2e 20 2a 2f 0d 76 6f |ytes lon|g. */.vo|
|000047a0| 69 64 0d 43 47 49 43 68 | 61 72 54 6f 48 65 78 20 |id.CGICh|arToHex |
|000047b0| 28 20 75 6e 73 69 67 6e | 65 64 20 63 68 61 72 20 |( unsign|ed char |
|000047c0| 74 68 65 43 68 61 72 2c | 20 63 68 61 72 20 2a 74 |theChar,| char *t|
|000047d0| 68 65 53 74 72 69 6e 67 | 20 29 0d 7b 0d 09 75 6e |heString| ).{..un|
|000047e0| 73 69 67 6e 65 64 20 63 | 68 61 72 09 63 68 72 43 |signed c|har.chrC|
|000047f0| 68 75 6e 6b 3b 0d 09 0d | 09 2f 2a 20 73 74 61 72 |hunk;...|./* star|
|00004800| 74 20 6f 66 66 20 77 69 | 74 68 20 61 20 70 65 72 |t off wi|th a per|
|00004810| 63 65 6e 74 20 73 79 6d | 62 6f 6c 20 74 6f 20 69 |cent sym|bol to i|
|00004820| 6e 64 69 63 61 74 65 20 | 61 20 68 65 78 20 63 68 |ndicate |a hex ch|
|00004830| 61 72 61 63 74 65 72 20 | 63 6f 64 65 20 2a 2f 0d |aracter |code */.|
|00004840| 09 74 68 65 53 74 72 69 | 6e 67 5b 30 5d 20 3d 20 |.theStri|ng[0] = |
|00004850| 27 25 27 3b 0d 09 0d 09 | 2f 2a 20 6d 61 73 6b 20 |'%';....|/* mask |
|00004860| 74 6f 20 67 65 74 20 74 | 68 65 20 68 69 67 68 20 |to get t|he high |
|00004870| 34 20 62 69 74 73 2c 20 | 74 68 65 6e 20 73 68 69 |4 bits, |then shi|
|00004880| 66 74 20 74 68 65 6d 20 | 69 6e 74 6f 20 74 68 65 |ft them |into the|
|00004890| 20 6c 6f 77 65 72 20 34 | 20 62 69 74 73 20 2a 2f | lower 4| bits */|
|000048a0| 0d 09 63 68 72 43 68 75 | 6e 6b 20 3d 20 28 20 74 |..chrChu|nk = ( t|
|000048b0| 68 65 43 68 61 72 20 26 | 20 30 78 46 30 20 29 20 |heChar &| 0xF0 ) |
|000048c0| 3e 3e 20 34 3b 0d 09 0d | 09 69 66 20 28 20 63 68 |>> 4;...|.if ( ch|
|000048d0| 72 43 68 75 6e 6b 20 3e | 20 39 20 29 0d 09 7b 0d |rChunk >| 9 )..{.|
|000048e0| 09 09 2f 2a 20 63 68 72 | 43 68 75 6e 6b 20 69 73 |../* chr|Chunk is|
|000048f0| 20 61 20 76 61 6c 75 65 | 20 62 65 74 77 65 65 6e | a value| between|
|00004900| 20 41 20 61 6e 64 20 46 | 20 69 6e 20 68 65 78 20 | A and F| in hex |
|00004910| 2a 2f 0d 09 09 74 68 65 | 53 74 72 69 6e 67 5b 31 |*/...the|String[1|
|00004920| 5d 20 3d 20 28 20 63 68 | 72 43 68 75 6e 6b 20 2d |] = ( ch|rChunk -|
|00004930| 20 31 30 20 29 20 2b 20 | 27 41 27 3b 0d 09 7d 0d | 10 ) + |'A';..}.|
|00004940| 09 65 6c 73 65 0d 09 7b | 0d 09 09 2f 2a 20 63 68 |.else..{|.../* ch|
|00004950| 72 43 68 75 6e 6b 20 69 | 73 20 61 20 76 61 6c 75 |rChunk i|s a valu|
|00004960| 65 20 62 65 74 77 65 65 | 6e 20 30 20 61 6e 64 20 |e betwee|n 0 and |
|00004970| 39 20 69 6e 20 68 65 78 | 20 2a 2f 0d 09 09 74 68 |9 in hex| */...th|
|00004980| 65 53 74 72 69 6e 67 5b | 31 5d 20 3d 20 63 68 72 |eString[|1] = chr|
|00004990| 43 68 75 6e 6b 20 2b 20 | 27 30 27 3b 0d 09 7d 0d |Chunk + |'0';..}.|
|000049a0| 09 0d 09 2f 2a 20 6d 61 | 73 6b 20 74 6f 20 67 65 |.../* ma|sk to ge|
|000049b0| 74 20 74 68 65 20 6c 6f | 77 20 34 20 62 69 74 73 |t the lo|w 4 bits|
|000049c0| 20 2a 2f 0d 09 63 68 72 | 43 68 75 6e 6b 20 3d 20 | */..chr|Chunk = |
|000049d0| 74 68 65 43 68 61 72 20 | 26 20 30 78 30 46 3b 0d |theChar |& 0x0F;.|
|000049e0| 09 0d 09 69 66 20 28 20 | 63 68 72 43 68 75 6e 6b |...if ( |chrChunk|
|000049f0| 20 3e 20 39 20 29 0d 09 | 7b 0d 09 09 2f 2a 20 63 | > 9 )..|{.../* c|
|00004a00| 68 72 43 68 75 6e 6b 20 | 69 73 20 61 20 76 61 6c |hrChunk |is a val|
|00004a10| 75 65 20 62 65 74 77 65 | 65 6e 20 41 20 61 6e 64 |ue betwe|en A and|
|00004a20| 20 46 20 69 6e 20 68 65 | 78 20 2a 2f 0d 09 09 74 | F in he|x */...t|
|00004a30| 68 65 53 74 72 69 6e 67 | 5b 32 5d 20 3d 20 28 20 |heString|[2] = ( |
|00004a40| 63 68 72 43 68 75 6e 6b | 20 2d 20 31 30 20 29 20 |chrChunk| - 10 ) |
|00004a50| 2b 20 27 41 27 3b 0d 09 | 7d 0d 09 65 6c 73 65 0d |+ 'A';..|}..else.|
|00004a60| 09 7b 0d 09 09 2f 2a 20 | 63 68 72 43 68 75 6e 6b |.{.../* |chrChunk|
|00004a70| 20 69 73 20 61 20 76 61 | 6c 75 65 20 62 65 74 77 | is a va|lue betw|
|00004a80| 65 65 6e 20 30 20 61 6e | 64 20 39 20 69 6e 20 68 |een 0 an|d 9 in h|
|00004a90| 65 78 20 2a 2f 0d 09 09 | 74 68 65 53 74 72 69 6e |ex */...|theStrin|
|00004aa0| 67 5b 32 5d 20 3d 20 63 | 68 72 43 68 75 6e 6b 20 |g[2] = c|hrChunk |
|00004ab0| 2b 20 27 30 27 3b 0d 09 | 7d 0d 7d 20 2f 2a 20 43 |+ '0';..|}.} /* C|
|00004ac0| 47 49 43 68 61 72 54 6f | 48 65 78 20 2a 2f 0d 0d |GICharTo|Hex */..|
|00004ad0| 0d 2f 2a 20 63 6f 6e 76 | 65 72 74 20 61 20 27 2f |./* conv|ert a '/|
|00004ae0| 27 20 64 65 6c 69 6d 69 | 74 65 64 20 70 61 74 68 |' delimi|ted path|
|00004af0| 20 74 6f 20 61 20 27 3a | 27 20 64 65 6c 69 6d 69 | to a ':|' delimi|
|00004b00| 74 65 64 20 6f 6e 65 2c | 20 61 6e 64 20 6d 61 6b |ted one,| and mak|
|00004b10| 65 20 73 75 72 65 20 74 | 68 65 72 65 27 73 0d 09 |e sure t|here's..|
|00004b20| 6f 6e 65 20 27 3a 27 20 | 61 74 20 74 68 65 20 73 |one ':' |at the s|
|00004b30| 74 61 72 74 20 69 66 20 | 74 68 65 20 70 61 74 68 |tart if |the path|
|00004b40| 20 69 6e 63 6c 75 64 65 | 73 20 66 6f 6c 64 65 72 | include|s folder|
|00004b50| 73 2e 0d 09 54 68 69 73 | 20 66 75 6e 63 74 69 6f |s...This| functio|
|00004b60| 6e 20 6d 61 79 20 6d 6f | 64 69 66 79 20 69 6f 50 |n may mo|dify ioP|
|00004b70| 61 74 68 53 74 72 69 6e | 67 2e 0d 09 69 6f 50 61 |athStrin|g...ioPa|
|00004b80| 74 68 53 74 72 69 6e 67 | 20 4d 55 53 54 20 68 61 |thString| MUST ha|
|00004b90| 76 65 20 61 6e 20 65 78 | 74 72 61 20 62 79 74 65 |ve an ex|tra byte|
|00004ba0| 20 61 66 74 65 72 20 69 | 74 73 20 74 65 72 6d 69 | after i|ts termi|
|00004bb0| 6e 61 74 69 6e 67 20 6e | 75 6c 6c 20 62 79 74 65 |nating n|ull byte|
|00004bc0| 2e 20 2a 2f 0d 76 6f 69 | 64 0d 43 47 49 50 61 74 |. */.voi|d.CGIPat|
|00004bd0| 68 54 6f 4d 61 63 50 61 | 74 68 20 28 20 63 68 61 |hToMacPa|th ( cha|
|00004be0| 72 20 2a 69 6f 50 61 74 | 68 53 74 72 69 6e 67 20 |r *ioPat|hString |
|00004bf0| 29 0d 7b 0d 09 63 68 61 | 72 20 2a 09 74 68 65 57 |).{..cha|r *.theW|
|00004c00| 6f 72 6b 53 74 72 69 6e | 67 3b 0d 09 63 68 61 72 |orkStrin|g;..char|
|00004c10| 20 2a 09 74 68 65 53 6c | 61 73 68 4f 66 66 73 65 | *.theSl|ashOffse|
|00004c20| 74 3b 0d 09 0d 09 2f 2a | 20 77 65 20 73 74 61 72 |t;..../*| we star|
|00004c30| 74 20 77 69 74 68 20 61 | 20 64 69 72 65 63 74 6f |t with a| directo|
|00004c40| 72 79 20 6d 61 72 6b 65 | 72 2c 20 73 6f 20 77 65 |ry marke|r, so we|
|00004c50| 20 77 6f 6e 27 74 20 6e | 65 65 64 20 74 6f 20 61 | won't n|eed to a|
|00004c60| 64 64 20 6f 6e 65 2e 20 | 2a 2f 0d 09 69 66 20 28 |dd one. |*/..if (|
|00004c70| 20 28 69 6f 50 61 74 68 | 53 74 72 69 6e 67 5b 30 | (ioPath|String[0|
|00004c80| 5d 20 3d 3d 20 27 2f 27 | 29 20 7c 7c 20 28 69 6f |] == '/'|) || (io|
|00004c90| 50 61 74 68 53 74 72 69 | 6e 67 5b 30 5d 20 3d 3d |PathStri|ng[0] ==|
|00004ca0| 20 27 3a 27 29 20 29 0d | 09 7b 0d 09 09 53 74 72 | ':') ).|.{...Str|
|00004cb0| 69 6e 67 43 6f 6e 76 65 | 72 74 43 68 61 72 54 6f |ingConve|rtCharTo|
|00004cc0| 43 68 61 72 20 28 20 69 | 6f 50 61 74 68 53 74 72 |Char ( i|oPathStr|
|00004cd0| 69 6e 67 2c 20 27 2f 27 | 2c 20 27 3a 27 20 29 3b |ing, '/'|, ':' );|
|00004ce0| 0d 09 7d 0d 09 65 6c 73 | 65 0d 09 7b 0d 09 09 2f |..}..els|e..{.../|
|00004cf0| 2a 20 63 68 65 63 6b 20 | 69 66 20 74 68 65 72 65 |* check |if there|
|00004d00| 20 61 72 65 20 61 6e 79 | 20 73 6c 61 73 68 65 73 | are any| slashes|
|00004d10| 20 2a 2f 0d 09 09 74 68 | 65 53 6c 61 73 68 4f 66 | */...th|eSlashOf|
|00004d20| 66 73 65 74 20 3d 20 73 | 74 72 63 68 72 20 28 20 |fset = s|trchr ( |
|00004d30| 69 6f 50 61 74 68 53 74 | 72 69 6e 67 2c 20 27 2f |ioPathSt|ring, '/|
|00004d40| 27 20 29 3b 0d 09 09 69 | 66 20 28 20 74 68 65 53 |' );...i|f ( theS|
|00004d50| 6c 61 73 68 4f 66 66 73 | 65 74 20 3d 3d 20 6e 69 |lashOffs|et == ni|
|00004d60| 6c 20 29 0d 09 09 7b 0d | 09 09 09 2f 2a 20 74 68 |l )...{.|.../* th|
|00004d70| 65 72 65 20 61 72 65 20 | 6e 6f 20 73 6c 61 73 68 |ere are |no slash|
|00004d80| 65 73 2c 20 73 6f 20 6e | 6f 74 68 69 6e 67 20 6e |es, so n|othing n|
|00004d90| 6f 20 63 68 61 6e 67 65 | 20 69 73 20 6e 65 65 64 |o change| is need|
|00004da0| 65 64 2e 20 2a 2f 0d 09 | 09 7d 0d 09 09 65 6c 73 |ed. */..|.}...els|
|00004db0| 65 0d 09 09 7b 0d 09 09 | 09 2f 2a 20 66 69 6e 64 |e...{...|./* find|
|00004dc0| 20 74 68 65 20 74 65 72 | 6d 69 6e 61 74 69 6e 67 | the ter|minating|
|00004dd0| 20 6e 75 6c 6c 20 62 79 | 74 65 20 61 74 20 74 68 | null by|te at th|
|00004de0| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 20 73 74 72 |e end of| the str|
|00004df0| 69 6e 67 20 2a 2f 0d 09 | 09 09 74 68 65 57 6f 72 |ing */..|..theWor|
|00004e00| 6b 53 74 72 69 6e 67 20 | 3d 20 73 74 72 63 68 72 |kString |= strchr|
|00004e10| 20 28 20 69 6f 50 61 74 | 68 53 74 72 69 6e 67 2c | ( ioPat|hString,|
|00004e20| 20 27 5c 30 27 20 29 3b | 0d 09 09 09 77 68 69 6c | '\0' );|....whil|
|00004e30| 65 20 28 20 74 68 65 57 | 6f 72 6b 53 74 72 69 6e |e ( theW|orkStrin|
|00004e40| 67 20 3e 3d 20 69 6f 50 | 61 74 68 53 74 72 69 6e |g >= ioP|athStrin|
|00004e50| 67 20 29 0d 09 09 09 7b | 0d 09 09 09 09 2f 2a 20 |g )....{|...../* |
|00004e60| 74 68 65 20 63 68 61 72 | 20 66 6f 6c 6c 6f 77 69 |the char| followi|
|00004e70| 6e 67 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 6f |ng the c|urrent o|
|00004e80| 6e 65 20 69 73 20 77 72 | 69 74 74 65 6e 20 61 73 |ne is wr|itten as|
|00004e90| 20 61 20 63 6f 6c 6f 6e | 20 69 66 0d 09 09 09 09 | a colon| if.....|
|00004ea0| 09 74 68 69 73 20 6f 6e | 65 20 69 73 20 61 20 73 |.this on|e is a s|
|00004eb0| 6c 61 73 68 2c 20 6f 72 | 20 68 61 73 20 74 68 69 |lash, or| has thi|
|00004ec0| 73 20 63 68 61 72 20 77 | 72 69 74 74 65 6e 20 74 |s char w|ritten t|
|00004ed0| 6f 20 69 74 20 2a 2f 0d | 09 09 09 09 74 68 65 57 |o it */.|....theW|
|00004ee0| 6f 72 6b 53 74 72 69 6e | 67 5b 31 5d 20 3d 20 28 |orkStrin|g[1] = (|
|00004ef0| 74 68 65 57 6f 72 6b 53 | 74 72 69 6e 67 5b 30 5d |theWorkS|tring[0]|
|00004f00| 20 3d 3d 20 27 2f 27 29 | 3f 20 27 3a 27 20 3a 20 | == '/')|? ':' : |
|00004f10| 74 68 65 57 6f 72 6b 53 | 74 72 69 6e 67 5b 30 5d |theWorkS|tring[0]|
|00004f20| 3b 0d 09 09 09 09 74 68 | 65 57 6f 72 6b 53 74 72 |;.....th|eWorkStr|
|00004f30| 69 6e 67 2d 2d 3b 0d 09 | 09 09 7d 0d 09 09 09 0d |ing--;..|..}.....|
|00004f40| 09 09 09 2f 2a 20 6d 61 | 6b 65 20 73 75 72 65 20 |.../* ma|ke sure |
|00004f50| 74 68 65 72 65 20 69 73 | 20 61 20 6c 65 61 64 69 |there is| a leadi|
|00004f60| 6e 67 20 63 6f 6c 6f 6e | 20 66 6f 72 20 74 68 65 |ng colon| for the|
|00004f70| 20 70 61 74 68 20 2a 2f | 0d 09 09 09 69 6f 50 61 | path */|....ioPa|
|00004f80| 74 68 53 74 72 69 6e 67 | 5b 30 5d 20 3d 20 27 3a |thString|[0] = ':|
|00004f90| 27 3b 0d 09 09 7d 0d 09 | 7d 0d 7d 20 2f 2a 20 43 |';...}..|}.} /* C|
|00004fa0| 47 49 50 61 74 68 54 6f | 4d 61 63 50 61 74 68 20 |GIPathTo|MacPath |
|00004fb0| 2a 2f 0d 0d 0d 2f 2a 2a | 20 20 4d 65 6d 6f 72 79 |*/.../**| Memory|
|00004fc0| 20 41 6c 6c 6f 63 61 74 | 69 6f 6e 20 43 6c 65 61 | Allocat|ion Clea|
|00004fd0| 6e 75 70 20 20 2a 2a 2f | 0d 23 70 72 61 67 6d 61 |nup **/|.#pragma|
|00004fe0| 20 6d 61 72 6b 20 2d 0d | 0d 2f 2a 20 20 2a 2f 0d | mark -.|./* */.|
|00004ff0| 73 74 61 74 69 63 20 76 | 6f 69 64 0d 63 67 69 44 |static v|oid.cgiD|
|00005000| 69 73 70 6f 73 65 48 61 | 6e 64 6c 65 20 28 20 43 |isposeHa|ndle ( C|
|00005010| 47 49 48 64 6c 20 74 68 | 65 43 47 49 48 64 6c 20 |GIHdl th|eCGIHdl |
|00005020| 29 0d 7b 0d 09 6d 79 5f | 61 73 73 65 72 74 20 28 |).{..my_|assert (|
|00005030| 20 74 68 65 43 47 49 48 | 64 6c 20 21 3d 20 6e 69 | theCGIH|dl != ni|
|00005040| 6c 2c 20 22 5c 70 63 67 | 69 44 69 73 70 6f 73 65 |l, "\pcg|iDispose|
|00005050| 48 61 6e 64 6c 65 3a 20 | 74 68 65 43 47 49 48 64 |Handle: |theCGIHd|
|00005060| 6c 20 69 73 20 6e 69 6c | 22 20 29 3b 0d 09 0d 09 |l is nil|" );....|
|00005070| 2f 2a 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |/* the f|ollowing|
|00005080| 20 69 73 20 61 20 62 75 | 6e 63 68 20 6f 66 20 73 | is a bu|nch of s|
|00005090| 74 61 74 65 6d 65 6e 74 | 73 20 63 68 65 63 6b 69 |tatement|s checki|
|000050a0| 6e 67 20 69 66 20 61 20 | 70 61 72 61 6d 65 74 65 |ng if a |paramete|
|000050b0| 72 20 68 61 73 20 62 65 | 65 6e 0d 09 09 61 6c 6c |r has be|en...all|
|000050c0| 6f 63 61 74 65 64 20 61 | 6e 64 20 64 69 73 70 6f |ocated a|nd dispo|
|000050d0| 73 69 6e 67 20 6f 66 20 | 69 74 20 69 66 20 69 74 |sing of |it if it|
|000050e0| 20 68 61 73 20 2a 2f 0d | 09 0d 09 23 69 66 20 6b | has */.|...#if k|
|000050f0| 43 6f 6d 70 69 6c 65 57 | 69 74 68 43 47 49 70 61 |CompileW|ithCGIpa|
|00005100| 74 68 5f 61 72 67 73 0d | 09 69 66 20 28 20 28 2a |th_args.|.if ( (*|
|00005110| 74 68 65 43 47 49 48 64 | 6c 29 2d 3e 70 61 74 68 |theCGIHd|l)->path|
|00005120| 5f 61 72 67 73 20 21 3d | 20 6e 69 6c 20 29 0d 09 |_args !=| nil )..|
|00005130| 7b 0d 09 09 44 69 73 70 | 6f 73 65 50 74 72 20 28 |{...Disp|osePtr (|
|00005140| 20 28 50 74 72 29 28 28 | 2a 74 68 65 43 47 49 48 | (Ptr)((|*theCGIH|
|00005150| 64 6c 29 2d 3e 70 61 74 | 68 5f 61 72 67 73 29 20 |dl)->pat|h_args) |
|00005160| 29 3b 0d 09 7d 0d 09 23 | 65 6e 64 69 66 0d 09 23 |);..}..#|endif..#|
|00005170| 69 66 20 6b 43 6f 6d 70 | 69 6c 65 57 69 74 68 43 |if kComp|ileWithC|
|00005180| 47 49 68 74 74 70 5f 73 | 65 61 72 63 68 5f 61 72 |GIhttp_s|earch_ar|
|00005190| 67 73 0d 09 69 66 20 28 | 20 28 2a 74 68 65 43 47 |gs..if (| (*theCG|
|000051a0| 49 48 64 6c 29 2d 3e 68 | 74 74 70 5f 73 65 61 72 |IHdl)->h|ttp_sear|
|000051b0| 63 68 5f 61 72 67 73 20 | 21 3d 20 6e 69 6c 20 29 |ch_args |!= nil )|
|000051c0| 0d 09 7b 0d 09 09 44 69 | 73 70 6f 73 65 50 74 72 |..{...Di|sposePtr|
|000051d0| 20 28 20 28 50 74 72 29 | 28 28 2a 74 68 65 43 47 | ( (Ptr)|((*theCG|
|000051e0| 49 48 64 6c 29 2d 3e 68 | 74 74 70 5f 73 65 61 72 |IHdl)->h|ttp_sear|
|000051f0| 63 68 5f 61 72 67 73 29 | 20 29 3b 0d 09 7d 0d 09 |ch_args)| );..}..|
|00005200| 23 65 6e 64 69 66 0d 09 | 23 69 66 20 6b 43 6f 6d |#endif..|#if kCom|
|00005210| 70 69 6c 65 57 69 74 68 | 43 47 49 66 72 6f 6d 5f |pileWith|CGIfrom_|
|00005220| 75 73 65 72 0d 09 69 66 | 20 28 20 28 2a 74 68 65 |user..if| ( (*the|
|00005230| 43 47 49 48 64 6c 29 2d | 3e 66 72 6f 6d 5f 75 73 |CGIHdl)-|>from_us|
|00005240| 65 72 20 21 3d 20 6e 69 | 6c 20 29 0d 09 7b 0d 09 |er != ni|l )..{..|
|00005250| 09 44 69 73 70 6f 73 65 | 50 74 72 20 28 20 28 50 |.Dispose|Ptr ( (P|
|00005260| 74 72 29 28 28 2a 74 68 | 65 43 47 49 48 64 6c 29 |tr)((*th|eCGIHdl)|
|00005270| 2d 3e 66 72 6f 6d 5f 75 | 73 65 72 29 20 29 3b 0d |->from_u|ser) );.|
|00005280| 09 7d 0d 09 23 65 6e 64 | 69 66 0d 09 23 69 66 20 |.}..#end|if..#if |
|00005290| 6b 43 6f 6d 70 69 6c 65 | 57 69 74 68 43 47 49 63 |kCompile|WithCGIc|
|000052a0| 6c 69 65 6e 74 5f 61 64 | 64 72 65 73 73 0d 09 69 |lient_ad|dress..i|
|000052b0| 66 20 28 20 28 2a 74 68 | 65 43 47 49 48 64 6c 29 |f ( (*th|eCGIHdl)|
|000052c0| 2d 3e 63 6c 69 65 6e 74 | 5f 61 64 64 72 65 73 73 |->client|_address|
|000052d0| 20 21 3d 20 6e 69 6c 20 | 29 0d 09 7b 0d 09 09 44 | != nil |)..{...D|
|000052e0| 69 73 70 6f 73 65 50 74 | 72 20 28 20 28 50 74 72 |isposePt|r ( (Ptr|
|000052f0| 29 28 28 2a 74 68 65 43 | 47 49 48 64 6c 29 2d 3e |)((*theC|GIHdl)->|
|00005300| 63 6c 69 65 6e 74 5f 61 | 64 64 72 65 73 73 29 20 |client_a|ddress) |
|00005310| 29 3b 0d 09 7d 0d 09 23 | 65 6e 64 69 66 0d 09 23 |);..}..#|endif..#|
|00005320| 69 66 20 6b 43 6f 6d 70 | 69 6c 65 57 69 74 68 43 |if kComp|ileWithC|
|00005330| 47 49 70 6f 73 74 5f 61 | 72 67 73 0d 09 69 66 20 |GIpost_a|rgs..if |
|00005340| 28 20 28 2a 74 68 65 43 | 47 49 48 64 6c 29 2d 3e |( (*theC|GIHdl)->|
|00005350| 70 6f 73 74 5f 61 72 67 | 73 20 21 3d 20 6e 69 6c |post_arg|s != nil|
|00005360| 20 29 0d 09 7b 0d 09 09 | 44 69 73 70 6f 73 65 50 | )..{...|DisposeP|
|00005370| 74 72 20 28 20 28 50 74 | 72 29 28 28 2a 74 68 65 |tr ( (Pt|r)((*the|
|00005380| 43 47 49 48 64 6c 29 2d | 3e 70 6f 73 74 5f 61 72 |CGIHdl)-|>post_ar|
|00005390| 67 73 29 20 29 3b 0d 09 | 7d 0d 09 23 65 6e 64 69 |gs) );..|}..#endi|
|000053a0| 66 0d 09 23 69 66 20 6b | 43 6f 6d 70 69 6c 65 57 |f..#if k|CompileW|
|000053b0| 69 74 68 43 47 49 73 65 | 72 76 65 72 5f 6e 61 6d |ithCGIse|rver_nam|
|000053c0| 65 0d 09 69 66 20 28 20 | 28 2a 74 68 65 43 47 49 |e..if ( |(*theCGI|
|000053d0| 48 64 6c 29 2d 3e 73 65 | 72 76 65 72 5f 6e 61 6d |Hdl)->se|rver_nam|
|000053e0| 65 20 21 3d 20 6e 69 6c | 20 29 0d 09 7b 0d 09 09 |e != nil| )..{...|
|000053f0| 44 69 73 70 6f 73 65 50 | 74 72 20 28 20 28 50 74 |DisposeP|tr ( (Pt|
|00005400| 72 29 28 28 2a 74 68 65 | 43 47 49 48 64 6c 29 2d |r)((*the|CGIHdl)-|
|00005410| 3e 73 65 72 76 65 72 5f | 6e 61 6d 65 29 20 29 3b |>server_|name) );|
|00005420| 0d 09 7d 0d 09 23 65 6e | 64 69 66 0d 09 23 69 66 |..}..#en|dif..#if|
|00005430| 20 6b 43 6f 6d 70 69 6c | 65 57 69 74 68 43 47 49 | kCompil|eWithCGI|
|00005440| 73 63 72 69 70 74 5f 6e | 61 6d 65 0d 09 69 66 20 |script_n|ame..if |
|00005450| 28 20 28 2a 74 68 65 43 | 47 49 48 64 6c 29 2d 3e |( (*theC|GIHdl)->|
|00005460| 73 63 72 69 70 74 5f 6e | 61 6d 65 20 21 3d 20 6e |script_n|ame != n|
|00005470| 69 6c 20 29 0d 09 7b 0d | 09 09 44 69 73 70 6f 73 |il )..{.|..Dispos|
|00005480| 65 50 74 72 20 28 20 28 | 50 74 72 29 28 28 2a 74 |ePtr ( (|Ptr)((*t|
|00005490| 68 65 43 47 49 48 64 6c | 29 2d 3e 73 63 72 69 70 |heCGIHdl|)->scrip|
|000054a0| 74 5f 6e 61 6d 65 29 20 | 29 3b 0d 09 7d 0d 09 23 |t_name) |);..}..#|
|000054b0| 65 6e 64 69 66 0d 09 23 | 69 66 20 6b 43 6f 6d 70 |endif..#|if kComp|
|000054c0| 69 6c 65 57 69 74 68 43 | 47 49 63 6f 6e 74 65 6e |ileWithC|GIconten|
|000054d0| 74 5f 74 79 70 65 0d 09 | 69 66 20 28 20 28 2a 74 |t_type..|if ( (*t|
|000054e0| 68 65 43 47 49 48 64 6c | 29 2d 3e 63 6f 6e 74 65 |heCGIHdl|)->conte|
|000054f0| 6e 74 5f 74 79 70 65 20 | 21 3d 20 6e 69 6c 20 29 |nt_type |!= nil )|
|00005500| 0d 09 7b 0d 09 09 44 69 | 73 70 6f 73 65 50 74 72 |..{...Di|sposePtr|
|00005510| 20 28 20 28 50 74 72 29 | 28 28 2a 74 68 65 43 47 | ( (Ptr)|((*theCG|
|00005520| 49 48 64 6c 29 2d 3e 63 | 6f 6e 74 65 6e 74 5f 74 |IHdl)->c|ontent_t|
|00005530| 79 70 65 29 20 29 3b 0d | 09 7d 0d 09 23 65 6e 64 |ype) );.|.}..#end|
|00005540| 69 66 0d 09 23 69 66 20 | 6b 43 6f 6d 70 69 6c 65 |if..#if |kCompile|
|00005550| 57 69 74 68 43 47 49 72 | 65 66 65 72 65 72 0d 09 |WithCGIr|eferer..|
|00005560| 69 66 20 28 20 28 2a 74 | 68 65 43 47 49 48 64 6c |if ( (*t|heCGIHdl|
|00005570| 29 2d 3e 72 65 66 65 72 | 65 72 20 21 3d 20 6e 69 |)->refer|er != ni|
|00005580| 6c 20 29 0d 09 7b 0d 09 | 09 44 69 73 70 6f 73 65 |l )..{..|.Dispose|
|00005590| 50 74 72 20 28 20 28 50 | 74 72 29 28 28 2a 74 68 |Ptr ( (P|tr)((*th|
|000055a0| 65 43 47 49 48 64 6c 29 | 2d 3e 72 65 66 65 72 65 |eCGIHdl)|->refere|
|000055b0| 72 29 20 29 3b 0d 09 7d | 0d 09 23 65 6e 64 69 66 |r) );..}|..#endif|
|000055c0| 0d 09 23 69 66 20 6b 43 | 6f 6d 70 69 6c 65 57 69 |..#if kC|ompileWi|
|000055d0| 74 68 43 47 49 75 73 65 | 72 5f 61 67 65 6e 74 0d |thCGIuse|r_agent.|
|000055e0| 09 69 66 20 28 20 28 2a | 74 68 65 43 47 49 48 64 |.if ( (*|theCGIHd|
|000055f0| 6c 29 2d 3e 75 73 65 72 | 5f 61 67 65 6e 74 20 21 |l)->user|_agent !|
|00005600| 3d 20 6e 69 6c 20 29 0d | 09 7b 0d 09 09 44 69 73 |= nil ).|.{...Dis|
|00005610| 70 6f 73 65 50 74 72 20 | 28 20 28 50 74 72 29 28 |posePtr |( (Ptr)(|
|00005620| 28 2a 74 68 65 43 47 49 | 48 64 6c 29 2d 3e 75 73 |(*theCGI|Hdl)->us|
|00005630| 65 72 5f 61 67 65 6e 74 | 29 20 29 3b 0d 09 7d 0d |er_agent|) );..}.|
|00005640| 09 23 65 6e 64 69 66 0d | 09 0d 09 23 69 66 20 6b |.#endif.|...#if k|
|00005650| 43 6f 6d 70 69 6c 65 57 | 69 74 68 43 47 49 41 63 |CompileW|ithCGIAc|
|00005660| 74 69 6f 6e 53 75 70 70 | 6f 72 74 0d 09 69 66 20 |tionSupp|ort..if |
|00005670| 28 20 28 2a 74 68 65 43 | 47 49 48 64 6c 29 2d 3e |( (*theC|GIHdl)->|
|00005680| 61 63 74 69 6f 6e 5f 70 | 61 74 68 20 21 3d 20 6e |action_p|ath != n|
|00005690| 69 6c 20 29 0d 09 7b 0d | 09 09 44 69 73 70 6f 73 |il )..{.|..Dispos|
|000056a0| 65 50 74 72 20 28 20 28 | 50 74 72 29 28 28 2a 74 |ePtr ( (|Ptr)((*t|
|000056b0| 68 65 43 47 49 48 64 6c | 29 2d 3e 61 63 74 69 6f |heCGIHdl|)->actio|
|000056c0| 6e 5f 70 61 74 68 29 20 | 29 3b 0d 09 7d 0d 09 23 |n_path) |);..}..#|
|000056d0| 65 6e 64 69 66 0d 09 0d | 09 23 69 66 20 6b 43 6f |endif...|.#if kCo|
|000056e0| 6d 70 69 6c 65 57 69 74 | 68 43 47 49 66 75 6c 6c |mpileWit|hCGIfull|
|000056f0| 5f 72 65 71 75 65 73 74 | 0d 09 69 66 20 28 20 28 |_request|..if ( (|
|00005700| 2a 74 68 65 43 47 49 48 | 64 6c 29 2d 3e 66 75 6c |*theCGIH|dl)->ful|
|00005710| 6c 5f 72 65 71 75 65 73 | 74 20 21 3d 20 6e 69 6c |l_reques|t != nil|
|00005720| 20 29 0d 09 7b 0d 09 09 | 44 69 73 70 6f 73 65 50 | )..{...|DisposeP|
|00005730| 74 72 20 28 20 28 50 74 | 72 29 28 28 2a 74 68 65 |tr ( (Pt|r)((*the|
|00005740| 43 47 49 48 64 6c 29 2d | 3e 66 75 6c 6c 5f 72 65 |CGIHdl)-|>full_re|
|00005750| 71 75 65 73 74 29 20 29 | 3b 0d 09 7d 0d 09 23 65 |quest) )|;..}..#e|
|00005760| 6e 64 69 66 0d 09 23 69 | 66 20 6b 43 6f 6d 70 69 |ndif..#i|f kCompi|
|00005770| 6c 65 57 69 74 68 43 47 | 49 76 65 72 73 69 6f 6e |leWithCG|Iversion|
|00005780| 0d 09 69 66 20 28 20 28 | 2a 74 68 65 43 47 49 48 |..if ( (|*theCGIH|
|00005790| 64 6c 29 2d 3e 76 65 72 | 73 69 6f 6e 20 21 3d 20 |dl)->ver|sion != |
|000057a0| 6e 69 6c 20 29 0d 09 7b | 0d 09 09 44 69 73 70 6f |nil )..{|...Dispo|
|000057b0| 73 65 50 74 72 20 28 20 | 28 50 74 72 29 28 28 2a |sePtr ( |(Ptr)((*|
|000057c0| 74 68 65 43 47 49 48 64 | 6c 29 2d 3e 76 65 72 73 |theCGIHd|l)->vers|
|000057d0| 69 6f 6e 29 20 29 3b 0d | 09 7d 0d 09 23 65 6e 64 |ion) );.|.}..#end|
|000057e0| 69 66 0d 09 0d 09 23 69 | 66 20 6b 43 6f 6d 70 69 |if....#i|f kCompi|
|000057f0| 6c 65 57 69 74 68 43 47 | 49 46 6f 72 6d 48 61 6e |leWithCG|IFormHan|
|00005800| 64 6c 69 6e 67 0d 09 69 | 66 20 28 20 28 2a 74 68 |dling..i|f ( (*th|
|00005810| 65 43 47 49 48 64 6c 29 | 2d 3e 66 6f 72 6d 46 69 |eCGIHdl)|->formFi|
|00005820| 65 6c 64 73 20 21 3d 20 | 6e 69 6c 20 29 0d 09 7b |elds != |nil )..{|
|00005830| 0d 09 09 43 47 49 46 6f | 72 6d 46 69 65 6c 64 73 |...CGIFo|rmFields|
|00005840| 44 69 73 70 6f 73 65 20 | 28 20 28 2a 74 68 65 43 |Dispose |( (*theC|
|00005850| 47 49 48 64 6c 29 2d 3e | 66 6f 72 6d 46 69 65 6c |GIHdl)->|formFiel|
|00005860| 64 73 20 29 3b 0d 09 7d | 0d 09 23 65 6e 64 69 66 |ds );..}|..#endif|
|00005870| 0d 09 0d 09 69 66 20 28 | 20 28 2a 74 68 65 43 47 |....if (| (*theCG|
|00005880| 49 48 64 6c 29 2d 3e 72 | 65 73 70 6f 6e 73 65 44 |IHdl)->r|esponseD|
|00005890| 61 74 61 20 21 3d 20 6e | 69 6c 20 29 0d 09 7b 0d |ata != n|il )..{.|
|000058a0| 09 09 23 69 66 20 6b 43 | 6f 6d 70 69 6c 65 57 69 |..#if kC|ompileWi|
|000058b0| 74 68 43 47 49 52 65 73 | 70 6f 6e 73 65 44 61 74 |thCGIRes|ponseDat|
|000058c0| 61 41 73 48 61 6e 64 6c | 65 0d 09 09 09 44 69 73 |aAsHandl|e....Dis|
|000058d0| 70 6f 73 65 48 61 6e 64 | 6c 65 20 28 20 28 2a 74 |poseHand|le ( (*t|
|000058e0| 68 65 43 47 49 48 64 6c | 29 2d 3e 72 65 73 70 6f |heCGIHdl|)->respo|
|000058f0| 6e 73 65 44 61 74 61 20 | 29 3b 0d 09 09 23 65 6c |nseData |);...#el|
|00005900| 73 65 0d 09 09 09 44 69 | 73 70 6f 73 65 50 74 72 |se....Di|sposePtr|
|00005910| 20 28 20 28 50 74 72 29 | 28 28 2a 74 68 65 43 47 | ( (Ptr)|((*theCG|
|00005920| 49 48 64 6c 29 2d 3e 72 | 65 73 70 6f 6e 73 65 44 |IHdl)->r|esponseD|
|00005930| 61 74 61 29 20 29 3b 0d | 09 09 23 65 6e 64 69 66 |ata) );.|..#endif|
|00005940| 0d 09 7d 0d 09 0d 09 44 | 69 73 70 6f 73 65 48 61 |..}....D|isposeHa|
|00005950| 6e 64 6c 65 20 28 20 28 | 48 61 6e 64 6c 65 29 74 |ndle ( (|Handle)t|
|00005960| 68 65 43 47 49 48 64 6c | 20 29 3b 0d 7d 20 2f 2a |heCGIHdl| );.} /*|
|00005970| 20 63 67 69 44 69 73 70 | 6f 73 65 48 61 6e 64 6c | cgiDisp|oseHandl|
|00005980| 65 20 2a 2f 0d 0d 0d 2f | 2a 2a 20 20 41 50 50 4c |e */.../|** APPL|
|00005990| 45 20 45 56 45 4e 54 20 | 53 55 50 50 4f 52 54 20 |E EVENT |SUPPORT |
|000059a0| 20 2a 2a 2f 0d 23 70 72 | 61 67 6d 61 20 6d 61 72 | **/.#pr|agma mar|
|000059b0| 6b 20 2d 0d 0d 2f 2a 20 | 41 70 70 6c 65 45 76 65 |k -../* |AppleEve|
|000059c0| 6e 74 20 48 61 6e 64 6c | 65 72 20 66 6f 72 20 74 |nt Handl|er for t|
|000059d0| 68 65 20 43 47 49 20 57 | 57 57 bd 2d 73 64 6f 63 |he CGI W|WW.-sdoc|
|000059e0| 20 65 76 65 6e 74 20 2a | 2f 0d 70 61 73 63 61 6c | event *|/.pascal|
|000059f0| 20 4f 53 45 72 72 0d 43 | 47 49 41 45 53 65 61 72 | OSErr.C|GIAESear|
|00005a00| 63 68 44 6f 63 20 28 20 | 41 70 70 6c 65 45 76 65 |chDoc ( |AppleEve|
|00005a10| 6e 74 20 2a 74 68 65 41 | 70 70 6c 65 45 76 65 6e |nt *theA|ppleEven|
|00005a20| 74 2c 20 41 70 70 6c 65 | 45 76 65 6e 74 20 2a 74 |t, Apple|Event *t|
|00005a30| 68 65 52 65 70 6c 79 2c | 20 6c 6f 6e 67 20 52 65 |heReply,| long Re|
|00005a40| 66 65 72 65 6e 63 65 20 | 29 0d 7b 0d 09 4f 53 45 |ference |).{..OSE|
|00005a50| 72 72 09 09 74 68 65 45 | 72 72 3b 0d 09 43 47 49 |rr..theE|rr;..CGI|
|00005a60| 48 64 6c 09 09 74 68 65 | 43 47 49 48 64 6c 3b 0d |Hdl..the|CGIHdl;.|
|00005a70| 09 23 69 66 20 6b 43 6f | 6d 70 69 6c 65 57 69 74 |.#if kCo|mpileWit|
|00005a80| 68 54 68 72 65 61 64 65 | 64 41 70 70 6c 65 45 76 |hThreade|dAppleEv|
|00005a90| 65 6e 74 73 0d 09 54 68 | 72 65 61 64 49 44 09 74 |ents..Th|readID.t|
|00005aa0| 68 65 54 68 72 65 61 64 | 3b 0d 09 23 65 6e 64 69 |heThread|;..#endi|
|00005ab0| 66 0d 09 0d 09 2f 2a 20 | 72 65 73 65 74 20 27 71 |f..../* |reset 'q|
|00005ac0| 75 69 74 20 6f 6e 20 69 | 64 6c 65 20 74 69 6d 65 |uit on i|dle time|
|00005ad0| 27 20 74 69 6d 65 72 20 | 2a 2f 0d 09 52 65 73 65 |' timer |*/..Rese|
|00005ae0| 74 51 75 69 74 49 64 6c | 65 54 69 6d 65 72 28 29 |tQuitIdl|eTimer()|
|00005af0| 3b 0d 09 0d 09 2f 2a 20 | 41 6c 6c 6f 63 61 74 65 |;..../* |Allocate|
|00005b00| 20 74 68 65 20 43 47 49 | 48 64 6c 20 64 61 74 61 | the CGI|Hdl data|
|00005b10| 20 73 74 72 75 63 74 75 | 72 65 20 2d 20 7a 65 72 | structu|re - zer|
|00005b20| 6f 69 6e 67 20 6f 75 74 | 20 69 74 73 20 63 6f 6e |oing out| its con|
|00005b30| 74 65 6e 74 73 2e 20 2a | 2f 0d 09 74 68 65 43 47 |tents. *|/..theCG|
|00005b40| 49 48 64 6c 20 3d 20 28 | 43 47 49 48 64 6c 29 20 |IHdl = (|CGIHdl) |
|00005b50| 4d 79 4e 65 77 48 61 6e | 64 6c 65 43 6c 65 61 72 |MyNewHan|dleClear|
|00005b60| 20 28 20 73 69 7a 65 6f | 66 28 43 47 49 72 65 63 | ( sizeo|f(CGIrec|
|00005b70| 6f 72 64 29 2c 20 26 74 | 68 65 45 72 72 20 29 3b |ord), &t|heErr );|
|00005b80| 0d 09 69 66 20 28 20 74 | 68 65 43 47 49 48 64 6c |..if ( t|heCGIHdl|
|00005b90| 20 3d 3d 20 6e 69 6c 20 | 29 0d 09 7b 0d 09 09 2f | == nil |)..{.../|
|00005ba0| 2a 20 6d 65 6d 6f 72 79 | 20 64 69 64 6e 27 74 20 |* memory| didn't |
|00005bb0| 61 6c 6c 6f 63 61 74 65 | 20 2d 20 63 61 6e 27 74 |allocate| - can't|
|00005bc0| 20 70 72 6f 63 65 73 73 | 20 63 67 69 20 2a 2f 0d | process| cgi */.|
|00005bd0| 09 09 72 65 74 75 72 6e | 20 74 68 65 45 72 72 3b |..return| theErr;|
|00005be0| 0d 09 7d 0d 09 0d 09 2f | 2a 20 73 74 6f 72 65 20 |..}..../|* store |
|00005bf0| 72 65 66 65 72 65 6e 63 | 65 73 20 74 6f 20 74 68 |referenc|es to th|
|00005c00| 65 20 61 70 70 6c 65 20 | 65 76 65 6e 74 20 61 6e |e apple |event an|
|00005c10| 64 20 72 65 70 6c 79 20 | 72 65 63 6f 72 64 73 20 |d reply |records |
|00005c20| 2a 2f 0d 09 28 2a 74 68 | 65 43 47 49 48 64 6c 29 |*/..(*th|eCGIHdl)|
|00005c30| 2d 3e 61 70 70 6c 65 45 | 76 65 6e 74 20 3d 20 2a |->appleE|vent = *|
|00005c40| 74 68 65 41 70 70 6c 65 | 45 76 65 6e 74 3b 0d 09 |theApple|Event;..|
|00005c50| 28 2a 74 68 65 43 47 49 | 48 64 6c 29 2d 3e 72 65 |(*theCGI|Hdl)->re|
|00005c60| 70 6c 79 45 76 65 6e 74 | 20 3d 20 2a 74 68 65 52 |plyEvent| = *theR|
|00005c70| 65 70 6c 79 3b 0d 09 0d | 2f 2f 09 4d 6f 76 65 48 |eply;...|//.MoveH|
|00005c80| 48 69 20 28 20 28 48 61 | 6e 64 6c 65 29 74 68 65 |Hi ( (Ha|ndle)the|
|00005c90| 43 47 49 48 64 6c 20 29 | 3b 0d 09 0d 09 23 69 66 |CGIHdl )|;....#if|
|00005ca0| 20 6b 43 6f 6d 70 69 6c | 65 57 69 74 68 54 68 72 | kCompil|eWithThr|
|00005cb0| 65 61 64 65 64 41 70 70 | 6c 65 45 76 65 6e 74 73 |eadedApp|leEvents|
|00005cc0| 0d 09 23 69 66 20 6b 43 | 6f 6d 70 69 6c 65 57 69 |..#if kC|ompileWi|
|00005cd0| 74 68 54 68 72 65 61 64 | 73 4f 70 74 69 6f 6e 61 |thThread|sOptiona|
|00005ce0| 6c 0d 09 69 66 20 28 20 | 67 48 61 73 54 68 72 65 |l..if ( |gHasThre|
|00005cf0| 61 64 4d 67 72 20 29 0d | 09 7b 0d 09 23 65 6e 64 |adMgr ).|.{..#end|
|00005d00| 69 66 0d 09 09 0d 09 09 | 2f 2a 20 49 74 20 69 73 |if......|/* It is|
|00005d10| 20 6e 65 63 65 73 73 61 | 72 79 20 74 6f 20 73 75 | necessa|ry to su|
|00005d20| 73 70 65 6e 64 20 74 68 | 65 20 41 70 70 6c 65 45 |spend th|e AppleE|
|00005d30| 76 65 6e 74 20 69 6e 20 | 6f 72 64 65 72 20 74 6f |vent in |order to|
|00005d40| 20 74 68 72 65 61 64 20 | 69 74 73 0d 09 09 09 70 | thread |its....p|
|00005d50| 72 6f 63 65 73 73 69 6e | 67 20 62 65 63 61 75 73 |rocessin|g becaus|
|00005d60| 65 20 6f 66 20 73 6f 6d | 65 20 72 65 61 6c 20 77 |e of som|e real w|
|00005d70| 65 69 72 64 6e 65 73 73 | 20 77 69 74 68 20 41 45 |eirdness| with AE|
|00005d80| 50 72 6f 63 65 73 73 41 | 70 70 6c 65 45 76 65 6e |ProcessA|ppleEven|
|00005d90| 74 0d 09 09 09 6e 6f 74 | 20 62 65 69 6e 67 20 22 |t....not| being "|
|00005da0| 72 65 65 6e 74 72 61 6e | 74 2e 22 20 54 68 69 73 |reentran|t." This|
|00005db0| 20 6d 65 61 6e 73 20 79 | 6f 75 20 63 61 6e 27 74 | means y|ou can't|
|00005dc0| 20 62 65 20 70 72 6f 63 | 65 73 73 69 6e 67 20 6d | be proc|essing m|
|00005dd0| 75 6c 74 69 70 6c 65 0d | 09 09 09 41 70 70 6c 65 |ultiple.|...Apple|
|00005de0| 20 45 76 65 6e 74 73 20 | 61 74 20 74 68 65 20 73 | Events |at the s|
|00005df0| 61 6d 65 20 74 69 6d 65 | 2c 20 73 6f 20 74 68 65 |ame time|, so the|
|00005e00| 79 20 68 61 76 65 20 74 | 6f 20 62 65 20 27 73 75 |y have t|o be 'su|
|00005e10| 73 70 65 6e 64 65 64 27 | 20 69 66 0d 09 09 09 79 |spended'| if....y|
|00005e20| 6f 75 20 77 61 6e 74 20 | 74 6f 20 64 65 61 6c 20 |ou want |to deal |
|00005e30| 77 69 74 68 20 6d 6f 72 | 65 20 74 68 61 6e 20 6f |with mor|e than o|
|00005e40| 6e 65 20 28 49 45 2e 20 | 6d 75 6c 74 69 2d 74 68 |ne (IE. |multi-th|
|00005e50| 72 65 61 64 65 64 20 70 | 72 6f 63 65 73 73 69 6e |readed p|rocessin|
|00005e60| 67 29 2e 20 2a 2f 0d 09 | 09 74 68 65 45 72 72 20 |g). */..|.theErr |
|00005e70| 3d 20 41 45 53 75 73 70 | 65 6e 64 54 68 65 43 75 |= AESusp|endTheCu|
|00005e80| 72 72 65 6e 74 45 76 65 | 6e 74 20 28 20 74 68 65 |rrentEve|nt ( the|
|00005e90| 41 70 70 6c 65 45 76 65 | 6e 74 20 29 3b 0d 09 09 |AppleEve|nt );...|
|00005ea0| 69 66 20 28 20 74 68 65 | 45 72 72 20 3d 3d 20 6e |if ( the|Err == n|
|00005eb0| 6f 45 72 72 29 0d 09 09 | 7b 0d 09 09 09 28 2a 74 |oErr)...|{....(*t|
|00005ec0| 68 65 43 47 49 48 64 6c | 29 2d 3e 73 75 73 70 65 |heCGIHdl|)->suspe|
|00005ed0| 6e 64 65 64 20 3d 20 74 | 72 75 65 3b 0d 09 09 09 |nded = t|rue;....|
|00005ee0| 2f 2a 20 41 70 70 6c 65 | 45 76 65 6e 74 20 68 61 |/* Apple|Event ha|
|00005ef0| 73 20 62 65 65 6e 20 73 | 75 73 70 65 6e 64 65 64 |s been s|uspended|
|00005f00| 2c 20 73 6f 20 77 65 20 | 63 61 6e 20 73 70 61 77 |, so we |can spaw|
|00005f10| 6e 20 61 20 74 68 72 65 | 61 64 20 66 6f 72 20 70 |n a thre|ad for p|
|00005f20| 72 6f 63 65 73 73 69 6e | 67 20 2a 2f 0d 09 09 09 |rocessin|g */....|
|00005f30| 74 68 65 45 72 72 20 3d | 20 4d 79 4e 65 77 54 68 |theErr =| MyNewTh|
|00005f40| 72 65 61 64 46 72 6f 6d | 50 6f 6f 6c 20 28 20 43 |readFrom|Pool ( C|
|00005f50| 47 49 41 45 53 65 61 72 | 63 68 44 6f 63 50 72 6f |GIAESear|chDocPro|
|00005f60| 63 65 73 73 54 68 72 65 | 61 64 2c 20 74 68 65 43 |cessThre|ad, theC|
|00005f70| 47 49 48 64 6c 2c 20 28 | 76 6f 69 64 2a 2a 29 6e |GIHdl, (|void**)n|
|00005f80| 69 6c 2c 20 26 74 68 65 | 54 68 72 65 61 64 20 29 |il, &the|Thread )|
|00005f90| 3b 0d 09 09 7d 0d 09 09 | 0d 09 23 69 66 20 6b 43 |;...}...|..#if kC|
|00005fa0| 6f 6d 70 69 6c 65 57 69 | 74 68 54 68 72 65 61 64 |ompileWi|thThread|
|00005fb0| 73 4f 70 74 69 6f 6e 61 | 6c 0d 09 7d 0d 09 23 65 |sOptiona|l..}..#e|
|00005fc0| 6e 64 69 66 0d 09 23 65 | 6e 64 69 66 20 2f 2a 20 |ndif..#e|ndif /* |
|00005fd0| 6b 43 6f 6d 70 69 6c 65 | 57 69 74 68 54 68 72 65 |kCompile|WithThre|
|00005fe0| 61 64 65 64 41 70 70 6c | 65 45 76 65 6e 74 73 20 |adedAppl|eEvents |
|00005ff0| 2a 2f 0d 09 0d 09 23 69 | 66 20 6b 43 6f 6d 70 69 |*/....#i|f kCompi|
|00006000| 6c 65 57 69 74 68 54 68 | 72 65 61 64 65 64 41 70 |leWithTh|readedAp|
|00006010| 70 6c 65 45 76 65 6e 74 | 73 0d 09 23 69 66 20 6b |pleEvent|s..#if k|
|00006020| 43 6f 6d 70 69 6c 65 57 | 69 74 68 54 68 72 65 61 |CompileW|ithThrea|
|00006030| 64 73 4f 70 74 69 6f 6e | 61 6c 0d 09 69 66 20 28 |dsOption|al..if (|
|00006040| 20 21 67 48 61 73 54 68 | 72 65 61 64 4d 67 72 20 | !gHasTh|readMgr |
|00006050| 7c 7c 20 28 74 68 65 45 | 72 72 20 21 3d 20 6e 6f ||| (theE|rr != no|
|00006060| 45 72 72 29 20 29 0d 09 | 23 65 6c 73 65 0d 09 69 |Err) )..|#else..i|
|00006070| 66 20 28 20 74 68 65 45 | 72 72 20 21 3d 20 6e 6f |f ( theE|rr != no|
|00006080| 45 72 72 20 29 0d 09 23 | 65 6e 64 69 66 0d 09 7b |Err )..#|endif..{|
|00006090| 0d 09 23 65 6e 64 69 66 | 0d 09 09 0d 09 09 2f 2a |..#endif|....../*|
|000060a0| 20 69 66 20 74 68 72 65 | 61 64 69 6e 67 20 69 73 | if thre|ading is|
|000060b0| 6e 27 74 20 61 76 61 69 | 6c 61 62 6c 65 2c 20 6f |n't avai|lable, o|
|000060c0| 72 20 74 68 65 20 61 74 | 74 65 6d 70 74 20 74 6f |r the at|tempt to|
|000060d0| 20 74 68 72 65 61 64 20 | 66 61 69 6c 65 64 2c 0d | thread |failed,.|
|000060e0| 09 09 09 6f 72 20 74 68 | 65 20 61 74 74 65 6d 70 |...or th|e attemp|
|000060f0| 74 20 74 6f 20 73 75 73 | 70 65 6e 64 20 74 68 65 |t to sus|pend the|
|00006100| 20 41 70 70 6c 65 45 76 | 65 6e 74 20 66 61 69 6c | AppleEv|ent fail|
|00006110| 65 64 2c 0d 09 09 09 70 | 72 6f 63 65 73 73 20 74 |ed,....p|rocess t|
|00006120| 68 65 20 41 70 70 6c 65 | 20 45 76 65 6e 74 20 77 |he Apple| Event w|
|00006130| 69 74 68 6f 75 74 20 74 | 68 72 65 61 64 69 6e 67 |ithout t|hreading|
|00006140| 2e 20 2a 2f 20 0d 09 09 | 74 68 65 45 72 72 20 3d |. */ ...|theErr =|
|00006150| 20 63 67 69 41 45 53 65 | 61 72 63 68 44 6f 63 50 | cgiAESe|archDocP|
|00006160| 72 6f 63 65 73 73 20 28 | 20 74 68 65 43 47 49 48 |rocess (| theCGIH|
|00006170| 64 6c 20 29 3b 0d 09 09 | 0d 09 23 69 66 20 6b 43 |dl );...|..#if kC|
|00006180| 6f 6d 70 69 6c 65 57 69 | 74 68 54 68 72 65 61 64 |ompileWi|thThread|
|00006190| 65 64 41 70 70 6c 65 45 | 76 65 6e 74 73 0d 09 7d |edAppleE|vents..}|
|000061a0| 0d 09 65 6c 73 65 0d 09 | 7b 0d 09 09 2f 2a 20 77 |..else..|{.../* w|
|000061b0| 65 20 73 75 73 70 65 6e | 64 65 64 20 74 68 65 20 |e suspen|ded the |
|000061c0| 41 45 2c 20 61 6e 64 20 | 73 70 61 77 6e 65 64 20 |AE, and |spawned |
|000061d0| 74 68 65 20 74 68 72 65 | 61 64 2c 20 6e 6f 77 20 |the thre|ad, now |
|000061e0| 6c 65 74 27 73 20 73 74 | 61 72 74 20 69 74 2e 20 |let's st|art it. |
|000061f0| 2a 2f 0d 09 09 59 69 65 | 6c 64 54 6f 54 68 72 65 |*/...Yie|ldToThre|
|00006200| 61 64 20 28 20 74 68 65 | 54 68 72 65 61 64 20 29 |ad ( the|Thread )|
|00006210| 3b 0d 09 7d 0d 09 23 65 | 6e 64 69 66 0d 09 0d 09 |;..}..#e|ndif....|
|00006220| 72 65 74 75 72 6e 20 74 | 68 65 45 72 72 3b 0d 7d |return t|heErr;.}|
|00006230| 20 2f 2a 20 43 47 49 41 | 45 53 65 61 72 63 68 44 | /* CGIA|ESearchD|
|00006240| 6f 63 20 2a 2f 0d 0d 0d | 2f 2a 20 45 6e 74 72 79 |oc */...|/* Entry|
|00006250| 20 70 6f 69 6e 74 20 66 | 6f 72 20 63 67 69 20 68 | point f|or cgi h|
|00006260| 61 6e 64 6c 65 72 20 74 | 68 72 65 61 64 2e 20 2a |andler t|hread. *|
|00006270| 2f 0d 23 69 66 20 6b 43 | 6f 6d 70 69 6c 65 57 69 |/.#if kC|ompileWi|
|00006280| 74 68 54 68 72 65 61 64 | 65 64 41 70 70 6c 65 45 |thThread|edAppleE|
|00006290| 76 65 6e 74 73 0d 70 61 | 73 63 61 6c 20 76 6f 69 |vents.pa|scal voi|
|000062a0| 64 20 2a 0d 43 47 49 41 | 45 53 65 61 72 63 68 44 |d *.CGIA|ESearchD|
|000062b0| 6f 63 50 72 6f 63 65 73 | 73 54 68 72 65 61 64 20 |ocProces|sThread |
|000062c0| 28 20 76 6f 69 64 20 2a | 74 68 72 65 61 64 50 61 |( void *|threadPa|
|000062d0| 72 61 6d 20 29 0d 7b 0d | 09 4f 53 45 72 72 09 09 |ram ).{.|.OSErr..|
|000062e0| 74 68 65 45 72 72 3b 0d | 09 43 47 49 48 64 6c 09 |theErr;.|.CGIHdl.|
|000062f0| 09 74 68 65 43 47 49 48 | 64 6c 3b 0d 09 54 68 72 |.theCGIH|dl;..Thr|
|00006300| 65 61 64 49 44 09 63 75 | 72 72 65 6e 74 54 68 72 |eadID.cu|rrentThr|
|00006310| 65 61 64 3b 0d 09 0d 09 | 6d 79 5f 61 73 73 65 72 |ead;....|my_asser|
|00006320| 74 20 28 20 74 68 72 65 | 61 64 50 61 72 61 6d 20 |t ( thre|adParam |
|00006330| 21 3d 20 6e 69 6c 2c 20 | 22 5c 70 43 47 49 41 45 |!= nil, |"\pCGIAE|
|00006340| 53 65 61 72 63 68 44 6f | 63 50 72 6f 63 65 73 73 |SearchDo|cProcess|
|00006350| 54 68 72 65 61 64 3a 20 | 74 68 65 20 43 47 49 20 |Thread: |the CGI |
|00006360| 68 61 6e 64 6c 65 20 28 | 74 68 72 65 61 64 50 61 |handle (|threadPa|
|00006370| 72 61 6d 29 20 69 73 20 | 6e 69 6c 22 20 29 3b 0d |ram) is |nil" );.|
|00006380| 09 0d 09 2f 2a 20 54 68 | 65 20 74 68 72 65 61 64 |.../* Th|e thread|
|00006390| 50 61 72 61 6d 20 69 73 | 20 75 73 65 64 20 74 6f |Param is| used to|
|000063a0| 20 70 61 73 73 20 74 68 | 65 20 43 47 49 48 64 6c | pass th|e CGIHdl|
|000063b0| 2e 20 2a 2f 0d 09 74 68 | 65 43 47 49 48 64 6c 20 |. */..th|eCGIHdl |
|000063c0| 3d 20 28 43 47 49 48 64 | 6c 29 74 68 72 65 61 64 |= (CGIHd|l)thread|
|000063d0| 50 61 72 61 6d 3b 0d 09 | 0d 09 74 68 65 45 72 72 |Param;..|..theErr|
|000063e0| 20 3d 20 63 67 69 41 45 | 53 65 61 72 63 68 44 6f | = cgiAE|SearchDo|
|000063f0| 63 50 72 6f 63 65 73 73 | 20 28 20 74 68 65 43 47 |cProcess| ( theCG|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.